Skip to content

Commit 8c59af5

Browse files
committed
[Clang] Handle ?: operator in fold expression
1 parent 90e0933 commit 8c59af5

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

clang/lib/Sema/SemaExpr.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8966,6 +8966,9 @@ ExprResult Sema::ActOnConditionalOp(SourceLocation QuestionLoc,
89668966
commonExpr = MatExpr.get();
89678967
}
89688968

8969+
if (commonExpr->getDependence() & ExprDependence::UnexpandedPack)
8970+
return ExprError();
8971+
89698972
opaqueValue = new (Context) OpaqueValueExpr(commonExpr->getExprLoc(),
89708973
commonExpr->getType(),
89718974
commonExpr->getValueKind(),

clang/lib/Sema/SemaTemplateVariadic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1510,7 +1510,7 @@ static void CheckFoldOperand(Sema &S, Expr *E) {
15101510
E = E->IgnoreImpCasts();
15111511
auto *OCE = dyn_cast<CXXOperatorCallExpr>(E);
15121512
if ((OCE && OCE->isInfixBinaryOp()) || isa<BinaryOperator>(E) ||
1513-
isa<AbstractConditionalOperator>(E)) {
1513+
isa<AbstractConditionalOperator>(E) || isa<RecoveryExpr>(E)) {
15141514
S.Diag(E->getExprLoc(), diag::err_fold_expression_bad_operand)
15151515
<< E->getSourceRange()
15161516
<< FixItHint::CreateInsertion(E->getBeginLoc(), "(")

0 commit comments

Comments
 (0)