| 1 |
// { dg-do compile { target c++17 } } |
| 2 |
// { dg-options "-fconcepts" } |
| 3 |
|
| 4 |
template<typename T> |
| 5 |
concept C1 = __is_same_as(T, int); |
| 6 |
|
| 7 |
template<int N> |
| 8 |
concept C2 = N == 0; |
| 9 |
|
| 10 |
template<template<typename> class X> |
| 11 |
concept C3 = true; |
| 12 |
|
| 13 |
template<typename> struct Foo; |
| 14 |
|
| 15 |
template<C1...> struct S1; |
| 16 |
template<C1... Ts> struct S1 { }; |
| 17 |
|
| 18 |
template<C2...> struct S2; // { dg-error "does not constrain a type" } |
| 19 |
template<C2... Ns> struct S2 { }; // { dg-error "does not constrain a type" } |
| 20 |
|
| 21 |
template<C3...> struct S3; // { dg-error "does not constrain a type" } |
| 22 |
template<C3... Xs> struct S3 { }; // { dg-error "does not constrain a type" } |
| 23 |
|
| 24 |
S1<int, int, int> s1; // OK |
| 25 |
S1<> s11; |
| 26 |
S2<0, 0, 0> s2; |
| 27 |
S2<> s22; // { dg-error "" } |
| 28 |
S3<Foo, Foo> s3; // { dg-error "" } |
| 29 |
S3<> s33; // { dg-error "" } |