summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGenCXX/value-init.cpp25
-rw-r--r--clang/test/SemaCXX/dcl_init_aggr.cpp9
2 files changed, 30 insertions, 4 deletions
diff --git a/clang/test/CodeGenCXX/value-init.cpp b/clang/test/CodeGenCXX/value-init.cpp
new file mode 100644
index 00000000000..decfc18e594
--- /dev/null
+++ b/clang/test/CodeGenCXX/value-init.cpp
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+
+struct A {
+ virtual ~A();
+};
+
+struct B : A { };
+
+struct C {
+ int i;
+ B b;
+};
+
+// CHECK: _Z15test_value_initv
+void test_value_init() {
+ // This value initialization requires zero initialization of the 'B'
+ // subobject followed by a call to its constructor.
+ // PR5800
+
+ // CHECK: store i32 17
+ // CHECK: call void @llvm.memset.i64
+ // CHECK: call void @_ZN1BC1Ev(%struct.A* %tmp1)
+ C c = { 17 } ;
+ // CHECK: call void @_ZN1CD1Ev(%struct.C* %c)
+}
diff --git a/clang/test/SemaCXX/dcl_init_aggr.cpp b/clang/test/SemaCXX/dcl_init_aggr.cpp
index a900411b980..f7dc8f11c70 100644
--- a/clang/test/SemaCXX/dcl_init_aggr.cpp
+++ b/clang/test/SemaCXX/dcl_init_aggr.cpp
@@ -40,17 +40,18 @@ char cv[4] = { 'a', 's', 'd', 'f', 0 }; // expected-error{{excess elements in ar
struct TooFew { int a; char* b; int c; };
TooFew too_few = { 1, "asdf" }; // okay
-struct NoDefaultConstructor { // expected-note 3 {{candidate function}}
+struct NoDefaultConstructor { // expected-note 3 {{candidate function}} \
+ // expected-note{{declared here}}
NoDefaultConstructor(int); // expected-note 3 {{candidate function}}
};
-struct TooFewError {
+struct TooFewError { // expected-error{{implicit default constructor for}}
int a;
- NoDefaultConstructor nodef;
+ NoDefaultConstructor nodef; // expected-note{{member is declared here}}
};
TooFewError too_few_okay = { 1, 1 };
TooFewError too_few_error = { 1 }; // expected-error{{no matching constructor}}
-TooFewError too_few_okay2[2] = { 1, 1 };
+TooFewError too_few_okay2[2] = { 1, 1 }; // expected-note{{implicit default constructor for 'struct TooFewError' first required here}}
TooFewError too_few_error2[2] = { 1 }; // expected-error{{no matching constructor}}
NoDefaultConstructor too_few_error3[3] = { }; // expected-error {{no matching constructor}}
OpenPOWER on IntegriCloud