brintos

brintos / llvm-project-archived public Read only

0
0
Text · 796 B · b65f111 Raw
21 lines · c
1// RUN: %clang_cc1 -fsyntax-only -std=c23 %s -verify2// UNSUPPORTED: target={{.*}}-zos{{.*}}3 4// Ensure that thread_local and _Thread_local are synonyms in C23 and both5// restrict local variables to be explicitly static or extern.6void 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.19extern thread_local unsigned a;20_Thread_local unsigned a = 0;21