gcc/testsuite/g++.dg/cpp2a/explicit16.C
raw| 1 | // PR c++/95066 - explicit malfunction with dependent expression. |
| 2 | // { dg-do compile { target c++20 } } |
| 3 | |
| 4 | template <typename T> |
| 5 | struct Foo { |
| 6 | template <typename U> |
| 7 | explicit(static_cast<U>(true)) operator Foo<U>(); |
| 8 | }; |
| 9 | |
| 10 | template <typename T> |
| 11 | template <typename U> |
| 12 | Foo<T>::operator Foo<U>() { |
| 13 | return {}; |
| 14 | } |
| 15 | |
| 16 | int |
| 17 | main () |
| 18 | { |
| 19 | Foo<float> a; |
| 20 | Foo<int> b = a; // { dg-error "conversion" } |
| 21 | } |