thread-local.cpp 925 B

1234567891011121314151617181920
  1. // RUN: %clang_cc1 -pedantic-errors -std=c++11 -triple x86_64-linux-gnu -emit-pch %s -o %t
  2. // RUN: %clang_cc1 -pedantic-errors -std=c++11 -triple x86_64-linux-gnu -include-pch %t -verify %s
  3. // REQUIRES: x86-registered-target
  4. #ifndef HEADER_INCLUDED
  5. #define HEADER_INCLUDED
  6. extern thread_local int a;
  7. extern _Thread_local int b;
  8. extern int c;
  9. #else
  10. _Thread_local int a; // expected-error {{thread-local declaration of 'a' with static initialization follows declaration with dynamic initialization}}
  11. // expected-note@7 {{previous declaration is here}}
  12. thread_local int b; // expected-error {{thread-local declaration of 'b' with dynamic initialization follows declaration with static initialization}}
  13. // expected-note@8 {{previous declaration is here}}
  14. thread_local int c; // expected-error {{thread-local declaration of 'c' follows non-thread-local declaration}}
  15. // expected-note@9 {{previous declaration is here}}
  16. #endif