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