2 // g++ 1.37.1 bug 900514_03
4 // g++ fails to flag ERRORs on the following erroneous code.
6 // In Section 12.3.2 it says "Defining conversion by both a constructor and
7 // a conversion function can lead to ambiguities." However in the case below,
8 // the explicit cast syntax disambiguates the constructor as one which
9 // invokes the type conversion operator rather than the conversion.
11 // NO, IT DOESN'T. It's still ambiguous. --jason 2002-12-03
13 // cfront 2.0 passes this test.
15 // keywords: user-defined type conversion operator, constructor
22 t_0_st_1 (t_0_st_0&);// { dg-error "" }
29 operator t_0_st_1 ();// { dg-error "" }
32 t_0_st_0 t_0_st_0_obj0;
34 void t_0_assignment ()
36 t_0_st_1 t_0_st_1_obj0;
37 t_0_st_1 t_0_st_1_obj1;
38 t_0_st_1 t_0_st_1_obj2;
40 t_0_st_1_obj0 = t_0_st_0_obj0; // { dg-error "" } caught
41 t_0_st_1_obj1 = t_0_st_1 (t_0_st_0_obj0);
44 void t_0_local_init ()
46 t_0_st_1 t_0_st_1_obj0 = t_0_st_0_obj0; // { dg-error "" }
47 t_0_st_1 t_0_st_1_obj1 = t_0_st_1 (t_0_st_0_obj0);
55 t_1_st_1 (t_1_st_0&); // { dg-error "" }
57 void operator= (t_1_st_1&); // { dg-error "" }
63 operator t_1_st_1 (); // { dg-error "" }
66 t_1_st_0 t_1_st_0_obj0;
68 void t_1_assignment ()
70 t_1_st_1 t_1_st_1_obj0;
71 t_1_st_1 t_1_st_1_obj1;
72 t_1_st_1 t_1_st_1_obj2;
74 t_1_st_1_obj0 = t_1_st_0_obj0; // { dg-error "" }
75 t_1_st_1_obj1 = t_1_st_1 (t_1_st_0_obj0); // { dg-error "" }
78 void t_1_local_init ()
80 t_1_st_1 t_1_st_1_obj0 = t_1_st_0_obj0; // { dg-error "" }
81 t_1_st_1 t_1_st_1_obj1 = t_1_st_1 (t_1_st_0_obj0);
89 t_2_st_1 (t_2_st_0); // { dg-error "" } candidate
96 operator t_2_st_1 (); // { dg-error "" } candidate
99 t_2_st_0 t_2_st_0_obj0;
101 void t_2_assignment ()
103 t_2_st_1 t_2_st_1_obj0;
104 t_2_st_1 t_2_st_1_obj1;
105 t_2_st_1 t_2_st_1_obj2;
107 t_2_st_1_obj0 = t_2_st_0_obj0; // { dg-error "" } caught
108 t_2_st_1_obj1 = t_2_st_1 (t_2_st_0_obj0);
111 void t_2_local_init ()
113 t_2_st_1 t_2_st_1_obj0 = t_2_st_0_obj0; // { dg-error "" }
114 t_2_st_1 t_2_st_1_obj1 = t_2_st_1 (t_2_st_0_obj0);