xref: /minix3/external/bsd/llvm/dist/clang/test/PCH/thread-local.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -pedantic-errors -std=c++11 -triple x86_64-linux-gnu -emit-pch %s -o %t
2*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -pedantic-errors -std=c++11 -triple x86_64-linux-gnu -include-pch %t -verify %s
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc #ifndef HEADER_INCLUDED
5*f4a2713aSLionel Sambuc 
6*f4a2713aSLionel Sambuc #define HEADER_INCLUDED
7*f4a2713aSLionel Sambuc extern thread_local int a;
8*f4a2713aSLionel Sambuc extern _Thread_local int b;
9*f4a2713aSLionel Sambuc extern int c;
10*f4a2713aSLionel Sambuc 
11*f4a2713aSLionel Sambuc #else
12*f4a2713aSLionel Sambuc 
13*f4a2713aSLionel Sambuc _Thread_local int a; // expected-error {{thread-local declaration of 'a' with static initialization follows declaration with dynamic initialization}}
14*f4a2713aSLionel Sambuc // expected-note@7 {{previous declaration is here}}
15*f4a2713aSLionel Sambuc thread_local int b; // expected-error {{thread-local declaration of 'b' with dynamic initialization follows declaration with static initialization}}
16*f4a2713aSLionel Sambuc // expected-note@8 {{previous declaration is here}}
17*f4a2713aSLionel Sambuc thread_local int c; // expected-error {{thread-local declaration of 'c' follows non-thread-local declaration}}
18*f4a2713aSLionel Sambuc // expected-note@9 {{previous declaration is here}}
19*f4a2713aSLionel Sambuc 
20*f4a2713aSLionel Sambuc #endif
21