| 1 |
// { dg-do compile { target c++17 } } |
| 2 |
// { dg-options "-fconcepts" } |
| 3 |
|
| 4 |
template<typename T> |
| 5 |
concept One = sizeof(T) >= 4; |
| 6 |
|
| 7 |
template<typename T> |
| 8 |
concept Two = One<T> && sizeof(T) >= 8; |
| 9 |
|
| 10 |
// Check ordering of partial specializaitons |
| 11 |
template<typename T> |
| 12 |
struct S2 { static const int value = 0; }; |
| 13 |
|
| 14 |
template<One T> |
| 15 |
struct S2<T> { static const int value = 1; }; |
| 16 |
|
| 17 |
template<Two T> |
| 18 |
struct S2<T> { static const int value = 2; }; |
| 19 |
|
| 20 |
struct one_type { char x[4]; }; |
| 21 |
struct two_type { char x[8]; }; |
| 22 |
|
| 23 |
static_assert(S2<char>::value == 0, ""); |
| 24 |
static_assert(S2<one_type>::value == 1, ""); |
| 25 |
static_assert(S2<two_type>::value == 2, ""); |
| 26 |
|
| 27 |
int main() { } |