gcc/testsuite/g++.old-deja/g++.brendan/copy7.C
raw| 1 | // { dg-do run } |
| 2 | // GROUPS passed copy-ctors |
| 3 | extern "C" int printf (const char *, ...); |
| 4 | extern "C" void exit (int); |
| 5 | |
| 6 | void die () { printf ("FAIL\n"); exit (1); } |
| 7 | |
| 8 | class B { |
| 9 | public: |
| 10 | B() {} |
| 11 | B(const B &) { printf ("PASS\n"); exit (0); } |
| 12 | private: |
| 13 | int x; |
| 14 | }; |
| 15 | |
| 16 | class A : public B { |
| 17 | public: |
| 18 | A() {} |
| 19 | |
| 20 | A(const B &) { printf ("FAIL\n"); exit (1); } |
| 21 | }; |
| 22 | |
| 23 | int |
| 24 | main() |
| 25 | { |
| 26 | A a; |
| 27 | A b(a); |
| 28 | |
| 29 | printf ("FAIL\n"); |
| 30 | return 1; |
| 31 | } |