| 1 |
// { dg-do compile { target c++17 } } |
| 2 |
// { dg-options "-fconcepts" } |
| 3 |
|
| 4 |
template<typename T> |
| 5 |
concept C = __is_class(T); |
| 6 |
|
| 7 |
struct X { }; |
| 8 |
|
| 9 |
template<typename T> |
| 10 |
struct Base { |
| 11 |
Base(double) requires C<T> { } |
| 12 |
}; |
| 13 |
|
| 14 |
struct Ok1 : Base<X> { |
| 15 |
using Base<X>::Base; |
| 16 |
}; |
| 17 |
|
| 18 |
struct Err1 : Base<int> { |
| 19 |
using Base<int>::Base; |
| 20 |
}; |
| 21 |
|
| 22 |
template<typename T> |
| 23 |
struct Generic : Base<T> { |
| 24 |
using Base<T>::Base; |
| 25 |
}; |
| 26 |
|
| 27 |
|
| 28 |
int main() { |
| 29 |
Ok1 x1(0.0); |
| 30 |
Err1 x2(0.0); // { dg-error "no matching" } |
| 31 |
Generic<X> x3(0.0); |
| 32 |
Generic<int> x4(0.0); // { dg-error "no matching" } |
| 33 |
} |