summaryrefslogtreecommitdiffstats
path: root/clang/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
commit5063613a3b62f30e6d11bfd90e24e43894b0f31b (patch)
treead5dc67c3e05f6c8a94bef51a6203886ad325514 /clang/lib/Sema/SemaInit.cpp
parentd48a008b46f7f9b37058aa8aa7c7fe67579f56e9 (diff)
downloadbcm5719-llvm-5063613a3b62f30e6d11bfd90e24e43894b0f31b.tar.gz
bcm5719-llvm-5063613a3b62f30e6d11bfd90e24e43894b0f31b.zip
Fix another test case.
llvm-svn: 72478
Diffstat (limited to 'clang/lib/Sema/SemaInit.cpp')
-rw-r--r--clang/lib/Sema/SemaInit.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index 951aaa3bc0f..5dc40a45934 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/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(),
OpenPOWER on IntegriCloud