diff options
author | Kaelyn Takata <rikka@google.com> | 2014-11-24 21:46:59 +0000 |
---|---|---|
committer | Kaelyn Takata <rikka@google.com> | 2014-11-24 21:46:59 +0000 |
commit | 13da33fdfe480ac6ecbddf95524cc870dc9bd4ef (patch) | |
tree | 76c269d8b03f4ffd2128c9c32625160cf1a2e0cc | |
parent | 074bbb698db6f2b4559a65a247e9d7aa0686de94 (diff) | |
download | bcm5719-llvm-13da33fdfe480ac6ecbddf95524cc870dc9bd4ef.tar.gz bcm5719-llvm-13da33fdfe480ac6ecbddf95524cc870dc9bd4ef.zip |
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
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 6 | ||||
-rw-r--r-- | clang/test/Sema/typo-correction.c | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index fd7c76121db..223e93e7c3d 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -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); diff --git a/clang/test/Sema/typo-correction.c b/clang/test/Sema/typo-correction.c index e98e5c00697..04cf0775f1d 100644 --- a/clang/test/Sema/typo-correction.c +++ b/clang/test/Sema/typo-correction.c @@ -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'{{$}}}} +} |