gcc/testsuite/g++.dg/tls/thread_local9.C
raw| 1 | // PR c++/61343 |
| 2 | |
| 3 | // { dg-do run { target c++11 } } |
| 4 | // { dg-add-options tls } |
| 5 | // { dg-require-effective-target tls_runtime } |
| 6 | |
| 7 | struct Foo { |
| 8 | int value; |
| 9 | |
| 10 | Foo() noexcept { |
| 11 | value = 12; |
| 12 | } |
| 13 | }; |
| 14 | |
| 15 | static thread_local Foo a{}; |
| 16 | |
| 17 | static __attribute__((noinline)) void UseA() { |
| 18 | if (a.value != 12) __builtin_abort(); |
| 19 | } |
| 20 | |
| 21 | int main() { |
| 22 | UseA(); |
| 23 | } |