Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Sema / thread_local.c
bloba0de0aa4e39a6e1a86bac54cd6703512319253ee
1 // RUN: %clang_cc1 -fsyntax-only -std=c23 %s -verify
3 // Ensure that thread_local and _Thread_local are synonyms in C23 and both
4 // restrict local variables to be explicitly static or extern.
5 void func(void) {
6 // FIXME: it would be nice if the diagnostic said 'thread_local' in this case.
7 thread_local int i = 12; // expected-error {{'_Thread_local' variables must have global storage}}
8 _Thread_local int j = 13; // expected-error {{'_Thread_local' variables must have global storage}}
10 static thread_local int k = 14;
11 static _Thread_local int l = 15;
13 extern thread_local int m;
14 extern thread_local int n;
17 // This would previously fail because the tls models were different.
18 extern thread_local unsigned a;
19 _Thread_local unsigned a = 0;