1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
10 // UNSUPPORTED: no-threads
12 // XFAIL: LIBCXX-FREEBSD-FIXME
14 // TODO: This test does start working with newer updates of the mingw-w64
15 // toolchain, when it includes the following commit:
16 // https://github.com/mingw-w64/mingw-w64/commit/71eddccd746c56d9cde28bb5620d027d49259de9
17 // Thus, remove this UNSUPPORTED marking after the next update of the CI
19 // UNSUPPORTED: target={{.*-windows-gnu}}
24 #include "make_test_thread.h"
30 explicit OrderChecker(int n
) : n_
{n
} { }
41 class CreatesThreadLocalInDestructor
{
43 ~CreatesThreadLocalInDestructor() {
44 thread_local OrderChecker checker
{ID
};
48 OrderChecker global
{7};
51 static OrderChecker fn_static
{5};
52 thread_local CreatesThreadLocalInDestructor
<2> creates_tl2
;
53 thread_local OrderChecker fn_thread_local
{1};
54 thread_local CreatesThreadLocalInDestructor
<0> creates_tl0
;
57 int main(int, char**) {
58 static OrderChecker fn_static
{6};
60 support::make_test_thread(thread_fn
).join();
63 thread_local OrderChecker fn_thread_local
{4};
64 thread_local CreatesThreadLocalInDestructor
<3> creates_tl
;