111
|
1 // PR c++/42844
|
|
2 // { dg-do compile { target c++11 } }
|
|
3
|
|
4 struct A // { dg-message "user-provided default constructor" }
|
|
5 {
|
|
6 int i;
|
|
7 A() = default; // { dg-message "not user-provided" }
|
|
8 };
|
|
9
|
|
10 struct Base
|
|
11 {
|
|
12 Base() {}
|
|
13 };
|
|
14
|
|
15 struct Derived : Base // { dg-message "user-provided default constructor" }
|
|
16 {
|
|
17 int i;
|
|
18 Derived() = default; // { dg-message "not user-provided" }
|
|
19 };
|
|
20
|
|
21 struct Derived2 : Base // { dg-message "user-provided default constructor" }
|
|
22 {
|
|
23 int i;
|
|
24 Derived2() = default; // { dg-message "not user-provided" }
|
|
25 Derived2( Derived2 const& ) = default;
|
|
26 };
|
|
27
|
|
28 struct Derived3 : Base // { dg-message "user-provided default constructor" }
|
|
29 {
|
|
30 int i;
|
|
31 Derived3( Derived3 const& ) = default;
|
|
32 Derived3() = default; // { dg-message "not user-provided" }
|
|
33 };
|
|
34
|
|
35 void f()
|
|
36 {
|
|
37 const A a; // { dg-error "uninitialized const" }
|
|
38 const Derived d; // { dg-error "uninitialized const" }
|
|
39 const Derived2 d2; // { dg-error "uninitialized const" }
|
|
40 const Derived3 d3; // { dg-error "uninitialized const" }
|
|
41 }
|