[clang] [Clang][C++23] Implement P2448R2: Relaxing some constexpr restrictions (PR #77753)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 11 06:23:23 PST 2024
================
@@ -1754,11 +1761,17 @@ static bool CheckConstexprParameterTypes(Sema &SemaRef,
const ParmVarDecl *PD = FD->getParamDecl(ArgIndex);
assert(PD && "null in a parameter list");
SourceLocation ParamLoc = PD->getLocation();
- if (CheckLiteralType(SemaRef, Kind, ParamLoc, *i,
- diag::err_constexpr_non_literal_param, ArgIndex + 1,
- PD->getSourceRange(), isa<CXXConstructorDecl>(FD),
- FD->isConsteval()))
+ if (CheckLiteralType(
+ SemaRef, Kind, ParamLoc, *i,
+ SemaRef.getLangOpts().CPlusPlus23
+ ? diag::warn_cxx23_compat_constexpr_non_literal_param
+ : diag::ext_constexpr_non_literal_param,
+ ArgIndex + 1, PD->getSourceRange(), isa<CXXConstructorDecl>(FD),
+ FD->isConsteval())) {
+ if (SemaRef.getLangOpts().CPlusPlus23)
+ return true;
return false;
+ }
----------------
cor3ntin wrote:
ditto
https://github.com/llvm/llvm-project/pull/77753
More information about the cfe-commits
mailing list