| 1 |
// { dg-do run } |
| 2 |
// { dg-options "-w" } |
| 3 |
// GROUPS passed ARM-compliance |
| 4 |
// arm file (also in cvt file) |
| 5 |
// Message-Id: <[email protected]> |
| 6 |
// From: [email protected] (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; |
| 16 |
Base(int ii) : i(ii) {} |
| 17 |
}; |
| 18 |
|
| 19 |
class Derived : public Base { |
| 20 |
public: |
| 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 |
|
| 30 |
int f(Base &b) { |
| 31 |
if (b.i == 99) |
| 32 |
{ printf ("PASS\n"); return 0; } |
| 33 |
else |
| 34 |
{ printf ("FAIL\n"); return 1; } |
| 35 |
} |
| 36 |
|
| 37 |
int main() { |
| 38 |
Derived d(99); |
| 39 |
return f(d); |
| 40 |
} |
| 41 |
|