[clang] [C23] Implement N3018: The constexpr specifier for object definitions (PR #73099)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 15 09:37:42 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 &&
----------------
AaronBallman wrote:
I think we need something similar here for mixing `typedef` and `constexpr`. A potential test case would be:
```
typedef constexpr int Foo;
constexpr typedef int Bar;
```
https://github.com/llvm/llvm-project/pull/73099
More information about the cfe-commits
mailing list