| 1 |
// PR c++/109160 |
| 2 |
// { dg-do compile { target c++20 } } |
| 3 |
|
| 4 |
template<class T, bool B> |
| 5 |
concept C = B; |
| 6 |
|
| 7 |
template<int> struct X { }; |
| 8 |
|
| 9 |
template<bool B> |
| 10 |
struct A { |
| 11 |
template<C<B> auto V> static void f(); |
| 12 |
template<C<B> auto V> static void g(X<V>); |
| 13 |
template<C<B> auto V> static inline int value; |
| 14 |
template<C<B> auto V> struct D { }; |
| 15 |
}; |
| 16 |
|
| 17 |
int main() { |
| 18 |
A<true>::f<0>(); |
| 19 |
A<false>::f<0>(); // { dg-error "no match|constraints" } |
| 20 |
|
| 21 |
A<true>::g(X<0>{}); |
| 22 |
A<false>::g(X<0>{}); // { dg-error "no match|constraints" } |
| 23 |
|
| 24 |
bool v1 = A<true>::value<0>; |
| 25 |
bool v2 = A<false>::value<0>; // { dg-error "constraints" } |
| 26 |
|
| 27 |
A<true>::D<0> d1; |
| 28 |
A<false>::D<0> d2; // { dg-error "constraints" } |
| 29 |
} |