diff options
| author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2012-02-22 09:07:21 +0000 |
|---|---|---|
| committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2012-02-22 09:07:21 +0000 |
| commit | e7c31a9a22cbe598799db016b4553cb5fe93fa93 (patch) | |
| tree | 125eaba74b5de36d5da32b70821248737000b4a8 /clang/lib/Sema | |
| parent | 3a32ed913bccf63bb9984b8534a36d280d8fbfab (diff) | |
| download | bcm5719-llvm-e7c31a9a22cbe598799db016b4553cb5fe93fa93.tar.gz bcm5719-llvm-e7c31a9a22cbe598799db016b4553cb5fe93fa93.zip | |
Throw away stray CXXDefaultArgExprs. Fixes PR12061.
I think there's a deeper problem here in the way TransformCXXConstructExpr works, but I won't tackle it now.
llvm-svn: 151146
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/SemaExprCXX.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index c8e640f1917..30f143a825b 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -1018,6 +1018,13 @@ Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal, } else if (Initializer && isa<InitListExpr>(Initializer)) initStyle = CXXNewExpr::ListInit; else { + // In template instantiation, the initializer could be a CXXDefaultArgExpr + // unwrapped from a CXXConstructExpr that was implicitly built. There is no + // particularly sane way we can handle this (especially since it can even + // occur for array new), so we throw the initializer away and have it be + // rebuilt. + if (Initializer && isa<CXXDefaultArgExpr>(Initializer)) + Initializer = 0; assert((!Initializer || isa<ImplicitValueInitExpr>(Initializer) || isa<CXXConstructExpr>(Initializer)) && "Initializer expression that cannot have been implicitly created."); |

