blob: 53043d67fb8193c846b24430079593aaf8dc3b96 [file] [log] [blame]
Richard Smith79c88c32018-09-26 19:00:16 +00001// RUN: %clang_cc1 -fsyntax-only -std=c++17 -Wc++2a-compat-pedantic -verify %s
2// RUN: %clang_cc1 -fsyntax-only -std=c++2a -pedantic -verify %s
3
4struct A { // expected-note 0+{{candidate}}
5 A() = default; // expected-note 0+{{candidate}}
6 int x, y;
7};
8A a1 = {1, 2};
9#if __cplusplus <= 201703L
10 // expected-warning@-2 {{aggregate initialization of type 'A' with user-declared constructors is incompatible with C++2a}}
11#else
12 // expected-error@-4 {{no matching constructor}}
13#endif
14A a2 = {};
15
16struct B : A { A a; };
17B b1 = {{}, {}}; // ok
18B b2 = {1, 2, 3, 4};
19#if __cplusplus <= 201703L
20 // expected-warning@-2 2{{aggregate initialization of type 'A' with user-declared constructors is incompatible with C++2a}}
21#else
22 // expected-error@-4 2{{no viable conversion from 'int' to 'A'}}
23#endif