Create embedded-5_0-branch branch for development on ARM embedded cores.
[official-gcc.git] / embedded-5_0-branch / gcc / testsuite / g++.old-deja / g++.bugs / 900511_01.C
blobe5dff0e2526fd799a46618e8208a7eceb06bffdd
1 // { dg-do run  }
2 // g++ 1.37.1 bug 900511_01
4 // g++ fails to properly apply user-defined type conversion operators
5 // in cases where is it not obvious that the given conversion is
6 // appropriate for the context (i.e. operator and other operands)
7 // where the conversion should take place.
9 // cfront 2.0 passes this test.
11 struct struct_1 {
12   int member;
14   operator int ();
17 struct_1::operator int ()
19   return 0;
22 struct struct_2 {
23   int member;
25   operator float ();
28 struct_2::operator float ()
30   return 0.0;
33 struct_1 struct_1_object;
34 struct_2 struct_2_object;
35 double d;
37 void test ()
39   d = struct_2_object + struct_1_object;        // OK
40   d = struct_1_object + struct_2_object;        // { dg-bogus "" } 
43 int main () { return 0; }