Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.bugs/900205_04.C

raw
1 // { dg-do assemble }
2 // g++ 1.36.1 bug 900205_04
3
4 // g++ allows a class for which an implicit default X::X() constructor must
5 // be created (implicitly by the compiler) to be derived from another class
6 // which does not have its own default X::X() constructor. This is illegal.
7
8 // Cfront 2.0 passes this test.
9
10 // keywords: default constructor, inheritance
11
12 // In ISO C++ 1998, such a derived class is not ill-formed, but if the
13 // implicitly-declared constructor is used, then it is implicitly
14 // defined and found to be ill-formed.
15
16 struct struct0 { // { dg-message "note" }
17 int data_member;
18
19 struct0 (int, void *); // suppresses implicit default constructor
20 };
21
22 struct0::struct0 (int, void *) // { dg-message "note" }
23 {
24 }
25
26 struct struct0_derived_struct_0 : public struct0 { // { dg-error "no matching|deleted" }
27 };
28
29 struct0_derived_struct_0 object; // { dg-message "synthesized|deleted" }
30
31 int main () { return 0; }