diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-10-17 21:40:42 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-10-17 21:40:42 +0000 |
commit | 089407be3fb616fb1246f2aee29b8a9c58ec7807 (patch) | |
tree | eefbf6893de67bec32aeb1304f23ae9902cfa896 /lib/Sema/SemaExprCXX.cpp | |
parent | 07ab20203fb4254f6152c9a7176732fe199adccd (diff) |
When type-checking a C++ "new" expression, don't type-check the actual
initialization if any of the constructor/initialization arguments are
type-dependent. Fixes PR5224.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84365 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExprCXX.cpp')
-rw-r--r-- | lib/Sema/SemaExprCXX.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index d56c426d00..b6dcd76d46 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -418,6 +418,7 @@ Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal, FunctionDecl *OperatorDelete = 0; Expr **PlaceArgs = (Expr**)PlacementArgs.get(); unsigned NumPlaceArgs = PlacementArgs.size(); + if (!AllocType->isDependentType() && !Expr::hasAnyTypeDependentArguments(PlaceArgs, NumPlaceArgs) && FindAllocationFunctions(StartLoc, @@ -448,7 +449,9 @@ Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal, Expr **ConsArgs = (Expr**)ConstructorArgs.get(); const RecordType *RT; unsigned NumConsArgs = ConstructorArgs.size(); - if (AllocType->isDependentType()) { + + if (AllocType->isDependentType() || + Expr::hasAnyTypeDependentArguments(ConsArgs, NumConsArgs)) { // Skip all the checks. } else if ((RT = AllocType->getAs<RecordType>()) && !AllocType->isAggregateType()) { @@ -491,7 +494,7 @@ Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal, } // FIXME: Also check that the destructor is accessible. (C++ 5.3.4p16) - + PlacementArgs.release(); ConstructorArgs.release(); ArraySizeE.release(); |