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

Mariya Podchishchaeva via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 26 09:08:51 PST 2024


================
@@ -1382,6 +1382,20 @@ void DeclSpec::Finish(Sema &S, const PrintingPolicy &Policy) {
       ThreadStorageClassSpec = TSCS_unspecified;
       ThreadStorageClassSpecLoc = SourceLocation();
     }
+    if (S.getLangOpts().C23 &&
+        getConstexprSpecifier() == ConstexprSpecKind::Constexpr) {
+      S.Diag(ConstexprLoc, diag::err_invalid_decl_spec_combination)
+          << DeclSpec::getSpecifierName(getThreadStorageClassSpec())
+          << SourceRange(getThreadStorageClassSpecLoc());
+    }
+  }
+
+  if (S.getLangOpts().C23 &&
----------------
Fznamznon wrote:

Added to [test/Sema/constexpr.c](https://github.com/llvm/llvm-project/pull/73099/files#diff-7e6598acf89214432a139512e0d49d60e31f5305eec787c72cc74dc2695ee344)

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


More information about the cfe-commits mailing list