gcc/testsuite/g++.dg/template/new8.C
raw| 1 | // PR c++/34336 |
| 2 | // { dg-do compile } |
| 3 | |
| 4 | struct A; |
| 5 | |
| 6 | template <class T> |
| 7 | struct S |
| 8 | { |
| 9 | T *m; |
| 10 | T &operator* () { return *m; } |
| 11 | }; |
| 12 | |
| 13 | struct B |
| 14 | { |
| 15 | B (const A &); |
| 16 | }; |
| 17 | |
| 18 | template <class T> |
| 19 | struct C |
| 20 | { |
| 21 | C (); |
| 22 | S<A> c; |
| 23 | }; |
| 24 | |
| 25 | template <class T> |
| 26 | C<T>::C () |
| 27 | { |
| 28 | B *b = new B (*c); |
| 29 | } |