Debian Codegraph @

gcc/testsuite/g++.dg/cpp0x/pr84497.C

raw
1 // PR 84497 mismatch with thread constructor fn weakness
2 // { dg-do compile { target c++11 } }
3 // { dg-require-weak "" }
4 // { dg-require-alias "" }
5 // { dg-skip-if "No .weak" { { hppa*-*-hpux* } && { ! lp64 } } }
6 // { dg-skip-if PR119369 { amdgcn-*-* } }
7
8 struct Base
9 {
10 int m;
11
12 Base() noexcept = default; // trivial but not constexpr
13 ~Base() noexcept = default;
14 };
15
16 struct Derived : Base {};
17 struct Container {
18 Base m;
19 };
20
21 #ifdef DEF
22 // This bit for exposition only.
23 // All items placed in .tbss
24 // __tls_init simply sets __tls_guard
25 // no aliases to __tls_init generated
26 thread_local Base base_obj;
27 thread_local Derived derived_obj;
28 thread_local Container container_obj;
29 #else
30 // Erroneously created strong undef refs to
31 // _ZTH11derived_obj, _ZTH13container_obj, _ZTH8base_obj
32 extern thread_local Base base_obj;
33 extern thread_local Derived derived_obj;
34 extern thread_local Container container_obj;
35 int main() { return !(&base_obj && &derived_obj && &container_obj);}
36 #endif
37
38 // { dg-final { scan-assembler ".weak\[ \t\]*_?_ZTH8base_obj" } }
39 // { dg-final { scan-assembler ".weak\[ \t\]*_?_ZTH11derived_obj" } }
40 // { dg-final { scan-assembler ".weak\[ \t\]*_?_ZTH13container_obj" } }