| 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 = false; |
| 12 |
|
| 13 |
template<typename> struct Foo; |
| 14 |
|
| 15 |
template<C1... Ts> struct S1 { }; |
| 16 |
template<C2... Ns> struct S2 { }; // { dg-error "does not constrain a type" } |
| 17 |
template<C3... Xs> struct S3 { }; // { dg-error "does not constrain a type" } |
| 18 |
|
| 19 |
S1<int, int, bool> s1; // { dg-error "constraint failure|invalid type" } |
| 20 |
S2<0, 1, 2> s2; // { dg-error "wrong number of template arguments" } |
| 21 |
S3<Foo> s3; |