diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-06-30 20:24:30 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-06-30 20:24:30 +0000 |
| commit | b8c414ccd1e3571367aa2b002e29f8f38a939fa4 (patch) | |
| tree | d0a49134bf0ca9eca4eef81b8a0297416ba3128c /clang/lib/Sema/SemaExprCXX.cpp | |
| parent | 5220d4e7608e8411e0be822c8d46d35767e7547c (diff) | |
| download | bcm5719-llvm-b8c414ccd1e3571367aa2b002e29f8f38a939fa4.tar.gz bcm5719-llvm-b8c414ccd1e3571367aa2b002e29f8f38a939fa4.zip | |
Fix typo-correction crash if a typo occurs within the operand of a
function-style cast to a non-dependent type which is then used in an invalid
way. We'd lose the "type dependent" bit here, and downstream Sema processing
would then discard the expression if it was used in a context where its type
rendered it invalid.
llvm-svn: 274267
Diffstat (limited to 'clang/lib/Sema/SemaExprCXX.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaExprCXX.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index ea1de0c6428..2cd00f8218a 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -1222,7 +1222,14 @@ Sema::ActOnCXXTypeConstructExpr(ParsedType TypeRep, if (!TInfo) TInfo = Context.getTrivialTypeSourceInfo(Ty, SourceLocation()); - return BuildCXXTypeConstructExpr(TInfo, LParenLoc, exprs, RParenLoc); + auto Result = BuildCXXTypeConstructExpr(TInfo, LParenLoc, exprs, RParenLoc); + // Avoid creating a non-type-dependent expression that contains typos. + // Non-type-dependent expressions are liable to be discarded without + // checking for embedded typos. + if (!Result.isInvalid() && Result.get()->isInstantiationDependent() && + !Result.get()->isTypeDependent()) + Result = CorrectDelayedTyposInExpr(Result.get()); + return Result; } /// ActOnCXXTypeConstructExpr - Parse construction of a specified type. |

