thread-specifier.c revision 4fb71b0cc3c199cc0c736b4ec4fabdd01f56f4e8
1// RUN: clang-cc -triple i686-pc-linux-gnu -fsyntax-only -verify %s
2
3__thread int t1;
4__thread extern int t2;
5__thread static int t3;
6__thread __private_extern__ int t4;
7struct t5 { __thread int x; }; // expected-error {{type name does not allow storage class to be specified}}
8__thread int t6(); // expected-error {{'__thread' is only allowed on variable declarations}}
9int f(__thread int t7) { // expected-error {{'__thread' is only allowed on variable declarations}}
10  __thread int t8; // expected-error {{'__thread' variables must have global storage}}
11  __thread extern int t9;
12  __thread static int t10;
13  __thread __private_extern__ int t11;
14  __thread auto int t12; // expected-error {{'__thread' variables must have global storage}}
15  __thread register int t13; // expected-error {{'__thread' variables must have global storage}}
16}
17__thread typedef int t14; // expected-error {{'__thread' is only allowed on variable declarations}}
18__thread int t15; // expected-note {{[previous definition is here}}
19int t15; // expected-error {{non-thread-local declaration of 't15' follows thread-local declaration}}
20int t16; // expected-note {{[previous definition is here}}
21__thread int t16; // expected-error {{thread-local declaration of 't16' follows non-thread-local declaration}}
22