| 1 |
// DR 2369 |
| 2 |
// { dg-do compile { target c++20 } } |
| 3 |
|
| 4 |
template <class T> struct Z { |
| 5 |
typedef typename T::x xx; |
| 6 |
}; |
| 7 |
template <class T> concept C = requires { typename T::A; }; |
| 8 |
template <C T> typename Z<T>::xx f(void *, T); // #1 |
| 9 |
template <class T> void f(int, T); // #2 |
| 10 |
struct A {} a; |
| 11 |
struct ZZ { |
| 12 |
template <class T, class = typename Z<T>::xx> operator T *(); |
| 13 |
operator int(); |
| 14 |
}; |
| 15 |
int main() { |
| 16 |
ZZ zz; |
| 17 |
f(1, a); // OK, deduction fails for #1 because there is no conversion from int to void* |
| 18 |
f(zz, 42); // OK, deduction fails for #1 because C<int> is not satisfied |
| 19 |
} |