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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 28 09:00:02 PST 2023


================
@@ -7894,6 +7898,17 @@ NamedDecl *Sema::ActOnVariableDeclarator(
         (getLangOpts().CPlusPlus17 ||
          Context.getTargetInfo().getCXXABI().isMicrosoft()))
       NewVD->setImplicitlyInline();
+
+    if (getLangOpts().C23) {
+      DeclSpec::TSCS TSC = D.getDeclSpec().getThreadStorageClassSpec();
+      if (TSC != TSCS_unspecified) {
+        Diag(D.getDeclSpec().getThreadStorageClassSpecLoc(),
+             diag::err_c23_thread_local_constexpr);
+      }
+      if (NewVD->hasExternalStorage())
+        Diag(D.getDeclSpec().getThreadStorageClassSpecLoc(),
+             diag::err_c23_extern_constexpr);
----------------
AaronBallman wrote:

I think this is better handled by `DeclSpec::Finish()`, WDYT?

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


More information about the cfe-commits mailing list