1// g++ 1.37.1 bug 900511_01 2 3// g++ fails to properly apply user-defined type conversion operators 4// in cases where is it not obvious that the given conversion is 5// appropriate for the context (i.e. operator and other operands) 6// where the conversion should take place. 7 8// cfront 2.0 passes this test. 9 10struct struct_1 { 11 int member; 12 13 operator int (); 14}; 15 16struct_1::operator int () 17{ 18 return 0; 19} 20 21struct struct_2 { 22 int member; 23 24 operator float (); 25}; 26 27struct_2::operator float () 28{ 29 return 0.0; 30} 31 32struct_1 struct_1_object; 33struct_2 struct_2_object; 34double d; 35 36void test () 37{ 38 d = struct_2_object + struct_1_object; // OK 39 d = struct_1_object + struct_2_object; // gets bogus error 40} 41 42int main () { return 0; } 43