gcc/testsuite/g++.dg/cpp2a/explicit12.C
raw| 1 | // P0892R2 |
| 2 | // { dg-do compile } |
| 3 | // { dg-options "-std=c++2a" } |
| 4 | |
| 5 | template<typename> struct A { |
| 6 | template<typename T, int N = 0> |
| 7 | explicit(N) operator T(); |
| 8 | }; |
| 9 | |
| 10 | template<typename> struct B { |
| 11 | template<typename T, int N = 1> |
| 12 | explicit(N) operator T(); |
| 13 | }; |
| 14 | |
| 15 | void |
| 16 | bar () |
| 17 | { |
| 18 | A<int> a; |
| 19 | int i = a; |
| 20 | |
| 21 | B<int> b; |
| 22 | int j = b; // { dg-error "cannot convert" } |
| 23 | } |