[clang] [C23] Use thread_local semantics (PR #70107)

via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 24 12:28:58 PDT 2023


================
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c23 %s -verify
+
+// Ensure that thread_local and _Thread_local are synonyms in C23 and both
+// restrict local variables to be explicitly static or extern.
+void func(void) {
+  // FIXME: it would be nice if the diagnostic said 'thread_local' in this case.
+  thread_local int i = 12;  // expected-error {{'_Thread_local' variables must have global storage}}
----------------
cor3ntin wrote:

Another solution would be to say 'thread local variables' which is spelling agnostic.

https://github.com/llvm/llvm-project/pull/70107


More information about the cfe-commits mailing list