gcc/testsuite/g++.dg/cpp0x/explicit5.C
raw| 1 | // test for extension of DR 899 to handle template ctors |
| 2 | // { dg-do run { target c++11 } } |
| 3 | |
| 4 | int r = 1; |
| 5 | |
| 6 | struct C { |
| 7 | C() { } |
| 8 | template <class T = int> C(C&, T = 0) { r = 0; } |
| 9 | }; |
| 10 | |
| 11 | C c; |
| 12 | |
| 13 | struct A |
| 14 | { |
| 15 | explicit operator C&() const { return c; } |
| 16 | }; |
| 17 | |
| 18 | int main() |
| 19 | { |
| 20 | A a; |
| 21 | C c2 (a); |
| 22 | |
| 23 | return r; |
| 24 | } |