Correct typos in C11 generic-selection expressions.

llvm-svn: 232760
This commit is contained in:
Kaelyn Takata 2015-03-19 20:56:07 +00:00
parent b4db1420c2
commit b939fb3478
2 changed files with 10 additions and 2 deletions

View File

@ -2368,7 +2368,8 @@ ExprResult Parser::ParseGenericSelectionExpression() {
// C11 6.5.1.1p3 "The controlling expression of a generic selection is
// not evaluated."
EnterExpressionEvaluationContext Unevaluated(Actions, Sema::Unevaluated);
ControllingExpr = ParseAssignmentExpression();
ControllingExpr =
Actions.CorrectDelayedTyposInExpr(ParseAssignmentExpression());
if (ControllingExpr.isInvalid()) {
SkipUntil(tok::r_paren, StopAtSemi);
return ExprError();
@ -2414,7 +2415,8 @@ ExprResult Parser::ParseGenericSelectionExpression() {
// FIXME: These expressions should be parsed in a potentially potentially
// evaluated context.
ExprResult ER(ParseAssignmentExpression());
ExprResult ER(
Actions.CorrectDelayedTyposInExpr(ParseAssignmentExpression()));
if (ER.isInvalid()) {
SkipUntil(tok::r_paren, StopAtSemi);
return ExprError();

View File

@ -28,3 +28,9 @@ void func(int arg) {
;
}
}
void banana(void); // expected-note {{'banana' declared here}}
int c11Generic(int arg) {
_Generic(hello, int : banana)(); // expected-error-re {{use of undeclared identifier 'hello'{{$}}}}
_Generic(arg, int : bandana)(); // expected-error {{use of undeclared identifier 'bandana'; did you mean 'banana'?}}
}