[clang] [C23] Implement N3018: The constexpr specifier for object definitions (PR #73099)

Mariya Podchishchaeva via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 29 03:24:33 PST 2023


================
@@ -2932,6 +2932,22 @@ def warn_private_extern : Warning<
 def note_private_extern : Note<
   "use __attribute__((visibility(\"hidden\"))) attribute instead">;
 
+// C23 constexpr
+def err_c23_thread_local_constexpr : Error<
+  "thread-local storage is not allowed with constexpr">;
+def err_c23_extern_constexpr : Error<
+  "extern specifier is not allowed with constexpr">;
----------------
Fznamznon wrote:

I'm not quite sure reusing `err_invalid_decl_spec_combination` will look clear enough, here is what I got while trying:
```
t3.c:2:1: error: cannot combine with previous 'extern' declaration specifier
    2 | constexpr extern int V79 = 10;
      | ^         ~~~~~~

```
If that is still better, I can update it.

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


More information about the cfe-commits mailing list