diff options
Diffstat (limited to 'clang/test/CodeGenCXX')
-rw-r--r-- | clang/test/CodeGenCXX/const-init-cxx11.cpp | 14 | ||||
-rw-r--r-- | clang/test/CodeGenCXX/constructor-init.cpp | 20 |
2 files changed, 34 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/const-init-cxx11.cpp b/clang/test/CodeGenCXX/const-init-cxx11.cpp index d1b91ba3f5c..07385eedbae 100644 --- a/clang/test/CodeGenCXX/const-init-cxx11.cpp +++ b/clang/test/CodeGenCXX/const-init-cxx11.cpp @@ -309,6 +309,20 @@ namespace VirtualMembers { static nsMemoryImpl sGlobalMemory; } +namespace PR13273 { + struct U { + int t; + U() = default; + }; + + struct S : U { + S() = default; + }; + + // CHECK: @_ZN7PR13273L1sE = {{.*}} zeroinitializer + const S s {}; +} + // Constant initialization tests go before this point, // dynamic initialization tests go after. 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<typename T> struct X { X(const X &); |