summaryrefslogtreecommitdiff
path: root/test/SemaCXX/cxx2a-initializer-aggregates.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/cxx2a-initializer-aggregates.cpp')
-rw-r--r--test/SemaCXX/cxx2a-initializer-aggregates.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/SemaCXX/cxx2a-initializer-aggregates.cpp b/test/SemaCXX/cxx2a-initializer-aggregates.cpp
new file mode 100644
index 0000000000000..9c438d399b348
--- /dev/null
+++ b/test/SemaCXX/cxx2a-initializer-aggregates.cpp
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -std=c++2a %s -verify
+
+namespace class_with_ctor {
+ struct A { // expected-note 6{{candidate}}
+ A() = default; // expected-note 3{{candidate}}
+ int x;
+ int y;
+ };
+ A a = {1, 2}; // expected-error {{no matching constructor}}
+
+ struct B {
+ int x;
+ int y;
+ };
+ B b1 = B(); // trigger declaration of implicit ctors
+ B b2 = {1, 2}; // ok
+
+ struct C : A {
+ A a;
+ };
+ C c1 = {{}, {}}; // ok, call default ctor twice
+ C c2 = {{1, 2}, {3, 4}}; // expected-error 2{{no matching constructor}}
+}