2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.bugs / 900514_03.C
bloba5419fb9ee95e2afbacb39820fb45f536489a19b
1 // { dg-do assemble  }
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
17 struct t_0_st_0;
19 struct t_0_st_1 {
20   int member;
22   t_0_st_1 (t_0_st_0&);// { dg-error "" } 
23   t_0_st_1 ();
26 struct t_0_st_0 {
27   int member;
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);
50 struct t_1_st_0;
52 struct t_1_st_1 {
53   int member;
55   t_1_st_1 (t_1_st_0&);                                 // { dg-error "" } 
56   t_1_st_1 ();
57   void operator= (t_1_st_1&);                           // { dg-error "" } 
60 struct t_1_st_0 {
61   int member;
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);
84 struct t_2_st_0;
86 struct t_2_st_1 {
87   int member;
89   t_2_st_1 (t_2_st_0);          // { dg-error "" } candidate
90   t_2_st_1 ();
93 struct t_2_st_0 {
94   int member;
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);