Eric Christopher | d82fdf0 | 2013-04-17 17:27:51 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -std=c++11 -triple=x86_64-linux-gnu -verify %s |
Richard Smith | df4cc0a | 2013-04-15 08:33:22 +0000 | [diff] [blame] | 2 | |
| 3 | struct S { |
| 4 | static thread_local int a; |
| 5 | static int b; // expected-note {{here}} |
| 6 | thread_local int c; // expected-error {{'thread_local' is only allowed on variable declarations}} |
| 7 | static thread_local int d; // expected-note {{here}} |
| 8 | }; |
| 9 | |
| 10 | thread_local int S::a; |
| 11 | thread_local int S::b; // expected-error {{thread-local declaration of 'b' follows non-thread-local declaration}} |
| 12 | thread_local int S::c; // expected-error {{non-static data member defined out-of-line}} |
| 13 | int S::d; // expected-error {{non-thread-local declaration of 'd' follows thread-local declaration}} |
| 14 | |
| 15 | thread_local int x[3]; |
| 16 | thread_local int y[3]; |
| 17 | thread_local int z[3]; // expected-note {{previous}} |
| 18 | |
| 19 | void f() { |
| 20 | thread_local int x; |
| 21 | static thread_local int y; |
| 22 | extern thread_local int z; // expected-error {{redefinition of 'z' with a different type}} |
| 23 | } |