diff options
author | cor3ntin <corentinjabot@gmail.com> | 2023-09-28 08:25:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-28 08:25:30 +0200 |
commit | 64ffe64d2dee03888ac6765c185b78d79bce3eca (patch) | |
tree | ac0371f482546c4d93bbb8404b1e2752c2384d02 /clang/lib/Parse/ParseDecl.cpp | |
parent | 9744909a126ead515c433097c0b5f76c98e9a5b4 (diff) | |
download | llvm-64ffe64d2dee03888ac6765c185b78d79bce3eca.zip llvm-64ffe64d2dee03888ac6765c185b78d79bce3eca.tar.gz llvm-64ffe64d2dee03888ac6765c185b78d79bce3eca.tar.bz2 |
[Clang] Handle sema of noexcept condition in their evaluation context. (#67538)
The conditions of a noexcept and explicit specifier are full
expressions. Before this patch, we would call ActOnFinishFullExpr on
these in the context of the enclosing expression, which would cause the
collect of odr-used variables (and subsequently capture attempts) in the
wrong (enclosing) context.
This was observable when parsing the noexcept specifier condition of a
lambda appearing in a wider full expression odr-using variables.
Fixes #67492
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 748b9d5..9bda4ec 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -4120,7 +4120,11 @@ void Parser::ParseDeclarationSpecifiers( ExprResult ExplicitExpr(static_cast<Expr *>(nullptr)); BalancedDelimiterTracker Tracker(*this, tok::l_paren); Tracker.consumeOpen(); - ExplicitExpr = ParseConstantExpression(); + + EnterExpressionEvaluationContext ConstantEvaluated( + Actions, Sema::ExpressionEvaluationContext::ConstantEvaluated); + + ExplicitExpr = ParseConstantExpressionInExprEvalContext(); ConsumedEnd = Tok.getLocation(); if (ExplicitExpr.isUsable()) { CloseParenLoc = Tok.getLocation(); |