Skip to content

Commit 247ea9d

Browse files
committed
address comments
1 parent 7e14846 commit 247ea9d

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,8 @@ Bug Fixes to C++ Support
967967
- Fixed an assertion failure about invalid conversion when calling lambda. (#GH96205).
968968
- Fixed a bug where the first operand of binary ``operator&`` would be transformed as if it was the operand
969969
of the address of operator. (#GH97483).
970-
- Fixed an assertion failure about constant expression did not evaluate to integer. (#GH96670).
970+
- Fixed an assertion failure about a constant expression which is a known integer but is not
971+
evaluated to an integer. (#GH96670).
971972

972973
Bug Fixes to AST Handling
973974
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/lib/AST/ExprConstant.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15858,10 +15858,13 @@ static bool FastEvaluateAsRValue(const Expr *Exp, Expr::EvalResult &Result,
1585815858
}
1585915859

1586015860
if (const auto *CE = dyn_cast<ConstantExpr>(Exp)) {
15861-
if (CE->hasAPValueResult() && !CE->getAPValueResult().isLValue()) {
15862-
Result.Val = CE->getAPValueResult();
15863-
IsConst = true;
15864-
return true;
15861+
if (CE->hasAPValueResult()) {
15862+
APValue APV = CE->getAPValueResult();
15863+
if (!APV.isLValue()) {
15864+
Result.Val = std::move(APV);
15865+
IsConst = true;
15866+
return true;
15867+
}
1586515868
}
1586615869

1586715870
// The SubExpr is usually just an IntegerLiteral.

0 commit comments

Comments
 (0)