1 // PR c++/51424 2 // { dg-do compile { target c++11 } } 3 4 template <class T > 5 struct S 6 { SS7 S() : S() {} // { dg-error "delegates to itself" } SS8 S(int x) : S(x) {} // { dg-error "delegates to itself" } 9 }; 10 11 struct B1 12 { B1B113 B1() : B1() {} // { dg-error "delegates to itself" } B1B114 B1(int y) : B1(y) {} // { dg-error "delegates to itself" } 15 }; 16 17 struct V1 : virtual B1 18 { V1V119 V1() : B1() {} V1V120 V1(int x) : B1(x) {} 21 }; 22 23 struct B2 24 { B2B225 B2() : B2() {} // { dg-error "delegates to itself" } B2B226 B2(int y) : B2(y) {} // { dg-error "delegates to itself" } 27 }; 28 29 struct V2 : virtual B2 30 { V2V231 V2() : V2() {} // { dg-error "delegates to itself" } V2V232 V2(int x) : V2(x) {} // { dg-error "delegates to itself" } 33 }; 34 35 struct B3 36 { B3B337 B3() {} B3B338 B3(int y) {} 39 }; 40 41 struct V3 : virtual B3 42 { V3V343 V3() : V3() {} // { dg-error "delegates to itself" } V3V344 V3(int x) : V3(x) {} // { dg-error "delegates to itself" } 45 }; 46 47 struct CE1 48 { CE1CE149 constexpr CE1() : CE1() {} // { dg-error "delegates to itself" } CE1CE150 constexpr CE1(int x) : CE1(x) {} // { dg-error "delegates to itself" } 51 }; 52 53 struct CEB2 54 { CEB2CEB255 constexpr CEB2() : CEB2() {} // { dg-error "delegates to itself" } CEB2CEB256 constexpr CEB2(int x) : CEB2(x) {} // { dg-error "delegates to itself" } 57 }; 58 59 struct CE2 : CEB2 60 { CE2CE261 constexpr CE2() : CEB2() {} CE2CE262 constexpr CE2(int x) : CEB2(x) {} 63 }; 64 65 S<int> s1; 66 S<int> s2(1); 67