gcc/testsuite/g++.old-deja/g++.law/cvt5.C
raw| 1 | // { dg-do assemble } |
| 2 | // GROUPS passed conversions |
| 3 | // cvt file |
| 4 | // Message-Id: <[email protected]> |
| 5 | // From: [email protected] (Jonas Nygren) |
| 6 | // Subject: g++ bug |
| 7 | // Date: Fri, 31 Jul 1992 14:28:56 GMT |
| 8 | |
| 9 | class A {}; |
| 10 | class B : public A {}; |
| 11 | |
| 12 | B b; |
| 13 | |
| 14 | class R{ |
| 15 | public: |
| 16 | R() {} |
| 17 | operator B&() { return b; } |
| 18 | }; |
| 19 | |
| 20 | void f(A&) {} |
| 21 | |
| 22 | int main(){ |
| 23 | R r; |
| 24 | |
| 25 | f(r); // problem to cast to B& and then to A& |
| 26 | } |
| 27 | |
| 28 |