Skip to content

[clang] Allow constexpr-unknown values pre C++23 #129646

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions clang/lib/AST/ExprConstant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3481,7 +3481,7 @@ static bool evaluateVarDeclInit(EvalInfo &Info, const Expr *E,
// C++23 [expr.const]p8 If we have a reference type allow unknown references
// and pointers.
bool AllowConstexprUnknown =
Info.getLangOpts().CPlusPlus23 && VD->getType()->isReferenceType();
Info.getLangOpts().CPlusPlus11 && VD->getType()->isReferenceType();

APValue::LValueBase Base(VD, Frame ? Frame->Index : 0, Version);

Expand Down Expand Up @@ -8931,7 +8931,7 @@ bool LValueExprEvaluator::VisitVarDecl(const Expr *E, const VarDecl *VD) {
// C++23 [expr.const]p8 If we have a reference type allow unknown references
// and pointers.
bool AllowConstexprUnknown =
Info.getLangOpts().CPlusPlus23 && VD->getType()->isReferenceType();
Info.getLangOpts().CPlusPlus11 && VD->getType()->isReferenceType();
// If we are within a lambda's call operator, check whether the 'VD' referred
// to within 'E' actually represents a lambda-capture that maps to a
// data-member/field within the closure object, and if so, evaluate to the
Expand Down
Loading