gcc/testsuite/g++.dg/tls/thread_local13-aux.cc
raw| 1 | // PR c++/109164 |
| 2 | |
| 3 | struct S { virtual void foo (); int s; }; |
| 4 | extern bool baz (); |
| 5 | |
| 6 | void |
| 7 | S::foo () |
| 8 | { |
| 9 | if (s != 42) |
| 10 | __builtin_abort (); |
| 11 | } |
| 12 | |
| 13 | S s; |
| 14 | |
| 15 | S & |
| 16 | qux () |
| 17 | { |
| 18 | s.s = 42; |
| 19 | return s; |
| 20 | } |
| 21 | |
| 22 | thread_local S &t = qux (); |
| 23 | |
| 24 | bool |
| 25 | bar () |
| 26 | { |
| 27 | return false; |
| 28 | } |
| 29 | |
| 30 | int |
| 31 | main () |
| 32 | { |
| 33 | if (baz ()) |
| 34 | __builtin_abort (); |
| 35 | } |