diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2011-11-27 22:09:28 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2011-11-27 22:09:28 +0000 |
commit | bceb75528a4a9757f85df002ab45c6002dc10f94 (patch) | |
tree | 1854d6fa4a0f29082f92528ba8a987b78f553e7f /lib | |
parent | 86811609d9353e3aed198045d56e790eb3b6118c (diff) |
In Sema::MaybeBindToTemporary, create a CXXBindTemporaryExpr for an
array of objects with non-trivial destructors. PR11365.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145203 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AST/ExprCXX.cpp | 5 | ||||
-rw-r--r-- | lib/Sema/SemaExprCXX.cpp | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/AST/ExprCXX.cpp b/lib/AST/ExprCXX.cpp index 99e9002a48..1bbf8494fa 100644 --- a/lib/AST/ExprCXX.cpp +++ b/lib/AST/ExprCXX.cpp @@ -618,8 +618,9 @@ CXXTemporary *CXXTemporary::Create(ASTContext &C, CXXBindTemporaryExpr *CXXBindTemporaryExpr::Create(ASTContext &C, CXXTemporary *Temp, Expr* SubExpr) { - assert(SubExpr->getType()->isRecordType() && - "Expression bound to a temporary must have record type!"); + assert((SubExpr->getType()->isRecordType() || + SubExpr->getType()->isArrayType()) && + "Expression bound to a temporary must have record or array type!"); return new (C) CXXBindTemporaryExpr(Temp, SubExpr); } diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 7b5c358f7d..973e92d214 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -4116,7 +4116,8 @@ ExprResult Sema::MaybeBindToTemporary(Expr *E) { if (!getLangOptions().CPlusPlus) return Owned(E); - const RecordType *RT = E->getType()->getAs<RecordType>(); + QualType ET = Context.getBaseElementType(E->getType()); + const RecordType *RT = ET->getAs<RecordType>(); if (!RT) return Owned(E); |