| 1 |
// PR c++/102104 |
| 2 |
// { dg-do compile { target c++17 } } |
| 3 |
|
| 4 |
struct A { |
| 5 |
using target_type = bool*; |
| 6 |
operator bool*(); |
| 7 |
}; |
| 8 |
|
| 9 |
struct B { |
| 10 |
using target_type = long*; |
| 11 |
operator long*(); |
| 12 |
}; |
| 13 |
|
| 14 |
template<typename... Bases> |
| 15 |
struct cls : private Bases... { |
| 16 |
using Bases::operator typename Bases::target_type...; |
| 17 |
}; |
| 18 |
|
| 19 |
cls<A, B> v1; |
| 20 |
bool* a1 = v1; |
| 21 |
long* b1 = v1; |
| 22 |
|
| 23 |
cls<B> v2; |
| 24 |
bool* a2 = v2; // { dg-error "cannot convert" } |
| 25 |
long* b2 = v2; |
| 26 |
|
| 27 |
cls<A> v3; |
| 28 |
bool* a3 = v3; |
| 29 |
long* b3 = v3; // { dg-error "cannot convert" } |