blob: e9b227970538235413f3713739cf7df01fbce3ca [file] [log] [blame]
Richard Smith5990db62013-04-15 08:33:22 +00001// RUN: %clang_cc1 -std=c++11 -verify %s
Eric Christopher6ddf14d2013-04-17 07:19:56 +00002// REQUIRES: thread_local_storage
Richard Smith5990db62013-04-15 08:33:22 +00003
4struct S {
5 static thread_local int a;
6 static int b; // expected-note {{here}}
7 thread_local int c; // expected-error {{'thread_local' is only allowed on variable declarations}}
8 static thread_local int d; // expected-note {{here}}
9};
10
11thread_local int S::a;
12thread_local int S::b; // expected-error {{thread-local declaration of 'b' follows non-thread-local declaration}}
13thread_local int S::c; // expected-error {{non-static data member defined out-of-line}}
14int S::d; // expected-error {{non-thread-local declaration of 'd' follows thread-local declaration}}
15
16thread_local int x[3];
17thread_local int y[3];
18thread_local int z[3]; // expected-note {{previous}}
19
20void f() {
21 thread_local int x;
22 static thread_local int y;
23 extern thread_local int z; // expected-error {{redefinition of 'z' with a different type}}
24}