gcc/testsuite/g++.dg/cpp2a/explicit7.C
raw| 1 | // P0892R2 |
| 2 | // { dg-do compile } |
| 3 | // { dg-options "-std=c++2a" } |
| 4 | |
| 5 | template<typename T> |
| 6 | struct B { |
| 7 | static const T value = true; |
| 8 | }; |
| 9 | |
| 10 | struct X { |
| 11 | template<typename T> |
| 12 | explicit(B<T>::value) operator T(); |
| 13 | }; |
| 14 | |
| 15 | int |
| 16 | main () |
| 17 | { |
| 18 | X x; |
| 19 | int i = x.operator int(); |
| 20 | int i3 = x; // { dg-error "cannot convert" } |
| 21 | int i2{x}; |
| 22 | } |