Force the correction of delayed typos in casts in non-C++ code.

Fixes PR21656, which is fallout from r222551 caused by an untested/missed
code path.

llvm-svn: 222694
This commit is contained in:
Kaelyn Takata 2014-11-24 21:46:59 +00:00
parent 074bbb698d
commit 13da33fdfe
2 changed files with 11 additions and 0 deletions

View File

@ -5299,6 +5299,12 @@ Sema::ActOnCastExpr(Scope *S, SourceLocation LParenLoc,
if (getLangOpts().CPlusPlus) {
// Check that there are no default arguments (C++ only).
CheckExtraCXXDefaultArguments(D);
} else {
// Make sure any TypoExprs have been dealt with.
ExprResult Res = CorrectDelayedTyposInExpr(CastExpr);
if (!Res.isUsable())
return ExprError();
CastExpr = Res.get();
}
checkUnusedDeclAttributes(D);

View File

@ -4,3 +4,8 @@
// than in C++ and may exhibit different behavior as a result.
__typeof__(struct F*) var[invalid]; // expected-error-re {{use of undeclared identifier 'invalid'{{$}}}}
void PR21656() {
float x;
x = (float)arst; // expected-error-re {{use of undeclared identifier 'arst'{{$}}}}
}