[clang] [clang][C23] Delay thread storage recovery for constexpr diagnostics (PR #236758)

Chen Miao via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 4 08:53:44 PST 2026


================
@@ -52,6 +52,11 @@ constexpr typedef int Bar; // expected-error {{typedef cannot be constexpr}}
 void f3(constexpr register int P1) { // expected-error {{function parameter cannot be constexpr}}
   constexpr register int V9 = 0;
   constexpr register auto V10 = 0.0;
+  // FIXME: The constexpr diagnostic calls a later _Thread_local "previous".
+  // Prefer "'_Thread_local' used with 'constexpr'".
----------------
ChenMiaoi wrote:

The current diagnostics look like this:

```
error: cannot combine with previous '_Thread_local' declaration specifier
  constexpr register _Thread_local int x = 1;
  ^                  ~~~~~~~~~~~~~
```

I also looked at GCC’s output, and I thought this wording was more straightforward:

```
error: '_Thread_local' used with 'constexpr'
  constexpr register _Thread_local int x = 1;
  ^~~~~~~~~
```

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


More information about the cfe-commits mailing list