gcc/testsuite/g++.dg/expr/copy1.C
raw| 1 | // PR c++/14035 |
| 2 | // { dg-do run } |
| 3 | |
| 4 | extern "C" void abort(); |
| 5 | |
| 6 | struct Blob { |
| 7 | int x, y; |
| 8 | Blob() { } |
| 9 | Blob(const Blob &b) { abort (); } |
| 10 | }; |
| 11 | struct Blobby : public Blob { }; |
| 12 | |
| 13 | struct Wooly { |
| 14 | operator const Blobby & () |
| 15 | { |
| 16 | return myBlobby; |
| 17 | } |
| 18 | Blobby myBlobby; |
| 19 | }; |
| 20 | |
| 21 | void catcher(const Blob &blo) |
| 22 | { } |
| 23 | |
| 24 | int main() |
| 25 | { |
| 26 | Wooly wooly; |
| 27 | catcher((const Blob &)wooly); |
| 28 | } |