diff options
author | Sean Hunt <scshunt@csclub.uwaterloo.ca> | 2011-05-13 21:10:11 +0000 |
---|---|---|
committer | Sean Hunt <scshunt@csclub.uwaterloo.ca> | 2011-05-13 21:10:11 +0000 |
commit | daebfef4b8c035d139f4b7d6f75be02b7a2c6218 (patch) | |
tree | d11daeef49062889cd015578b36b12cb5a9dd447 /lib | |
parent | c1b5fa41f09512c74030b9a2a0d1564535e22a76 (diff) |
Fix copy constructor deletion detection with array types.
This fixes PR9910
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131309 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 77d20aec83..3f011a5982 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -3521,8 +3521,15 @@ bool Sema::ShouldDeleteCopyConstructor(CXXConstructorDecl *CD) { } } - InitializedEntity MemberEntity = - InitializedEntity::InitializeMember(*FI, 0); + llvm::SmallVector<InitializedEntity, 4> Entities; + QualType CurType = FI->getType(); + Entities.push_back(InitializedEntity::InitializeMember(*FI, 0)); + while (CurType->isArrayType()) { + Entities.push_back(InitializedEntity::InitializeElement(Context, 0, + Entities.back())); + CurType = Context.getAsArrayType(CurType)->getElementType(); + } + InitializationKind Kind = InitializationKind::CreateDirect(SourceLocation(), SourceLocation(), SourceLocation()); @@ -3536,7 +3543,7 @@ bool Sema::ShouldDeleteCopyConstructor(CXXConstructorDecl *CD) { Expr *Arg = new (Context) OpaqueValueExpr(SourceLocation(), ArgType, VK_LValue); - InitializationSequence InitSeq(*this, MemberEntity, Kind, &Arg, 1); + InitializationSequence InitSeq(*this, Entities.back(), Kind, &Arg, 1); if (InitSeq.getKind() == InitializationSequence::FailedSequence) return true; |