1 // RUN: %clang_cc1 -fsyntax-only -std=c23 %s -verify
2 // UNSUPPORTED: target={{.*}}-zos{{.*}}
3
4 // Ensure that thread_local and _Thread_local are synonyms in C23 and both
5 // restrict local variables to be explicitly static or extern.
func(void)6 void func(void) {
7 // FIXME: it would be nice if the diagnostic said 'thread_local' in this case.
8 thread_local int i = 12; // expected-error {{'_Thread_local' variables must have global storage}}
9 _Thread_local int j = 13; // expected-error {{'_Thread_local' variables must have global storage}}
10
11 static thread_local int k = 14;
12 static _Thread_local int l = 15;
13
14 extern thread_local int m;
15 extern thread_local int n;
16 }
17
18 // This would previously fail because the tls models were different.
19 extern thread_local unsigned a;
20 _Thread_local unsigned a = 0;
21