Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.bugs/900207_03.C

raw
1 // { dg-do run }
2 // g++ 1.36.1 bug 900207_03
3
4 // g++ fails to allow objects of class or struct types to be initialized
5 // using "constructor syntax" in cases where an implicitly generated copy
6 // constructor would be invoked for the initialization, and where there is
7 // no explicitly specified constructor associated with the type of the
8 // object being initialized.
9
10 // Note that the type of the error changes depending upon whether or not the
11 // type being initialized has any virtual functions associated with it.
12
13 // Cfront 2.0 passes this test.
14
15 // keywords: implicit copy constructor, initialization
16
17
18 // Check construction for a type without virtual function members.
19
20 struct struct0 {
21 int data_member;
22 };
23
24 struct0 struct0_gbl_object0;
25 struct0 struct0_gbl_object1 (struct0_gbl_object0); // { dg-bogus "" }
26
27 void struct0_test ()
28 {
29 struct0 struct0_lcl_object1 (struct0_gbl_object0); // { dg-bogus "" }
30 }
31
32 // Check construction for a type with virtual function members.
33
34 struct struct1 {
35 int data_member;
36
37 virtual void function_member ();
38 };
39
40 void struct1::function_member () { }
41
42 struct1 struct1_gbl_object0;
43 struct1 struct1_gbl_object1 (struct1_gbl_object0); // { dg-bogus "" }
44
45 void struct1_test ()
46 {
47 struct1 struct1_lcl_object1 (struct1_gbl_object0); // { dg-bogus "" }
48 }
49
50 int main () { return 0; }