1 // { dg-do run } 2 // { dg-options "-w" } 3 // GROUPS passed ARM-compliance 4 // arm file (also in cvt file) 5 // Message-Id: <9303061246.AA09402@gjetost.cs.wisc.edu> 6 // From: solomon@cs.wisc.edu (Marvin Solomon) 7 // Subject: Incorrect resolution of conversion path 8 // Date: Sat, 6 Mar 93 06:46:27 -0600 9 10 11 extern "C" int printf (const char *, ...); 12 13 class Base { 14 public: 15 int i; Base(int ii)16 Base(int ii) : i(ii) {} 17 }; 18 19 class Derived : public Base { 20 public: Derived(int ii)21 Derived(int ii) : Base(ii) {} 22 operator Base&(); 23 }; 24 25 Derived::operator Base&() { 26 Base *b = new Base(100*i); 27 return *b; 28 } 29 f(Base & b)30int f(Base &b) { 31 if (b.i == 99) 32 { printf ("PASS\n"); return 0; } 33 else 34 { printf ("FAIL\n"); return 1; } 35 } 36 main()37int main() { 38 Derived d(99); 39 return f(d); 40 } 41 42