2018-11-07 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / cpp1z / inh-ctor22.C
blob02ec58a3e8e0e746a7a5371e705707cf631de6a2
1 // Testcase from P0136
2 // { dg-do compile { target c++11 } }
4 struct B1 {
5   template <class... Ts>
6   B1(int, Ts...) { }
7 };
9 struct B2 {
10   B2(double) { }
13 int get();
15 struct D1 : B1 {                // { dg-message "B1::B1" }
16   using B1::B1;  // inherits B1(int, ...)
17   int x;
18   int y = get();
21 void test() {
22   D1 d(2, 3, 4); // OK: B1 is initialized by calling B1(2, 3, 4),
23   // then d.x is default-initialized (no initialization is performed),
24   // then d.y is initialized by calling get()
25   D1 e;          // { dg-error "" } D1 has a deleted default constructor
28 struct D2 : B2 {
29   using B2::B2;                 // { dg-message "B1::B1" }
30   B1 b;
33 D2 f(1.0);       // { dg-error "" } B1 has no default constructor