aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaInit.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-05-27 16:38:58 +0000
committerAnders Carlsson <andersca@mac.com>2009-05-27 16:38:58 +0000
commitbffed8a98cf5775cd39dc1765abc75c914513012 (patch)
treecbea0bfcc49da3bc24a569701babbdc6d479c144 /lib/Sema/SemaInit.cpp
parent7c520cf417e7a4eceeefef0a8b2a2b33811f0481 (diff)
Fix another test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72478 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaInit.cpp')
-rw-r--r--lib/Sema/SemaInit.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp
index 951aaa3bc0..5dc40a4593 100644
--- a/lib/Sema/SemaInit.cpp
+++ b/lib/Sema/SemaInit.cpp
@@ -156,6 +156,14 @@ bool Sema::CheckInitializerTypes(Expr *&Init, QualType &DeclType,
// class of the destination, constructors are considered.
if ((DeclTypeC.getUnqualifiedType() == InitTypeC.getUnqualifiedType()) ||
IsDerivedFrom(InitTypeC, DeclTypeC)) {
+ const CXXRecordDecl *RD =
+ cast<CXXRecordDecl>(DeclType->getAsRecordType()->getDecl());
+
+ // No need to make a CXXConstructExpr if both the ctor and dtor are
+ // trivial.
+ if (RD->hasTrivialConstructor() && RD->hasTrivialDestructor())
+ return false;
+
CXXConstructorDecl *Constructor
= PerformInitializationByConstructor(DeclType, &Init, 1,
InitLoc, Init->getSourceRange(),