111
|
1 // PR c++/51424
|
|
2 // { dg-do compile { target c++11 } }
|
|
3
|
|
4 template <class T >
|
|
5 struct S
|
|
6 {
|
|
7 S() : S() {} // { dg-error "delegates to itself" }
|
|
8 S(int x) : S(x) {} // { dg-error "delegates to itself" }
|
|
9 };
|
|
10
|
|
11 struct B1
|
|
12 {
|
|
13 B1() : B1() {} // { dg-error "delegates to itself" }
|
|
14 B1(int y) : B1(y) {} // { dg-error "delegates to itself" }
|
|
15 };
|
|
16
|
|
17 struct V1 : virtual B1
|
|
18 {
|
|
19 V1() : B1() {}
|
|
20 V1(int x) : B1(x) {}
|
|
21 };
|
|
22
|
|
23 struct B2
|
|
24 {
|
|
25 B2() : B2() {} // { dg-error "delegates to itself" }
|
|
26 B2(int y) : B2(y) {} // { dg-error "delegates to itself" }
|
|
27 };
|
|
28
|
|
29 struct V2 : virtual B2
|
|
30 {
|
|
31 V2() : V2() {} // { dg-error "delegates to itself" }
|
|
32 V2(int x) : V2(x) {} // { dg-error "delegates to itself" }
|
|
33 };
|
|
34
|
|
35 struct B3
|
|
36 {
|
|
37 B3() {}
|
|
38 B3(int y) {}
|
|
39 };
|
|
40
|
|
41 struct V3 : virtual B3
|
|
42 {
|
|
43 V3() : V3() {} // { dg-error "delegates to itself" }
|
|
44 V3(int x) : V3(x) {} // { dg-error "delegates to itself" }
|
|
45 };
|
|
46
|
|
47 struct CE1
|
|
48 {
|
|
49 constexpr CE1() : CE1() {} // { dg-error "delegates to itself" }
|
|
50 constexpr CE1(int x) : CE1(x) {} // { dg-error "delegates to itself" }
|
|
51 };
|
|
52
|
|
53 struct CEB2
|
|
54 {
|
|
55 constexpr CEB2() : CEB2() {} // { dg-error "delegates to itself" }
|
|
56 constexpr CEB2(int x) : CEB2(x) {} // { dg-error "delegates to itself" }
|
|
57 };
|
|
58
|
|
59 struct CE2 : CEB2
|
|
60 {
|
|
61 constexpr CE2() : CEB2() {}
|
|
62 constexpr CE2(int x) : CEB2(x) {}
|
|
63 };
|
|
64
|
|
65 S<int> s1;
|
|
66 S<int> s2(1);
|