From d86812d95c3a592f40e5249dfef324b456ea26d7 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 5 Jul 2012 08:39:21 +0000 Subject: PR13273: When performing list-initialization with an empty initializer list, actually perform value initialization rather than trying to fake it with a call to the default constructor. Fixes various bugs related to the previously-missing zero-initialization in this case. I've also moved this and the other list initialization 'special case' from TryConstructorInitialization into TryListInitialization where they belong. llvm-svn: 159733 --- clang/test/CodeGenCXX/constructor-init.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'clang/test/CodeGenCXX/constructor-init.cpp') diff --git a/clang/test/CodeGenCXX/constructor-init.cpp b/clang/test/CodeGenCXX/constructor-init.cpp index 9f808f6680e..b33184e3966 100644 --- a/clang/test/CodeGenCXX/constructor-init.cpp +++ b/clang/test/CodeGenCXX/constructor-init.cpp @@ -131,6 +131,26 @@ namespace rdar9694300 { } } +// Check that we emit a zero initialization step for list-value-initialization +// which calls a trivial default constructor. +namespace PR13273 { + struct U { + int t; + U() = default; + }; + + struct S : U { + S() = default; + }; + + // CHECK: define {{.*}}@_ZN7PR132731fEv( + int f() { + // CHECK-NOT: } + // CHECK: llvm.memset{{.*}}i8 0 + return (new S{})->t; + } +} + template struct X { X(const X &); -- cgit v1.2.3