LHS = Actions.ActOnConditionalOp(OpToken.getLocation(), ColonLoc,
LHS.get(), TernaryMiddle.get(),
RHS.get());
- } else
- // Ensure potential typos in the RHS aren't left undiagnosed.
+ } else {
+ // Ensure potential typos aren't left undiagnosed.
+ Actions.CorrectDelayedTyposInExpr(TernaryMiddle);
Actions.CorrectDelayedTyposInExpr(RHS);
+ }
}
}
// doesn't handle dependent types properly, so make sure any TypoExprs have
// been dealt with before checking the operands.
ExprResult CondResult = CorrectDelayedTyposInExpr(CondExpr);
- if (!CondResult.isUsable()) return ExprError();
+ ExprResult LHSResult = CorrectDelayedTyposInExpr(LHSExpr);
+ ExprResult RHSResult = CorrectDelayedTyposInExpr(RHSExpr);
+
+ if (!CondResult.isUsable())
+ return ExprError();
+
+ if (LHSExpr) {
+ if (!LHSResult.isUsable())
+ return ExprError();
+ }
+
+ if (!RHSResult.isUsable())
+ return ExprError();
+
CondExpr = CondResult.get();
+ LHSExpr = LHSResult.get();
+ RHSExpr = RHSResult.get();
}
// If this is the gnu "x ?: y" extension, analyze the types as though the LHS
f(THIS_IS_AN_ERROR, // expected-error {{use of undeclared identifier 'THIS_IS_AN_ERROR'}}
afunction(afunction_)); // expected-error {{use of undeclared identifier 'afunction_'; did you mean 'afunction'?}}
}
+
+int d = X ? d : L; // expected-error 2 {{use of undeclared identifier}}