blob: cb2ac5d93115be137abe886ff1b45689e035ebef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
// { dg-do compile { target c++20 } }
// A poor mans Integral concept.
template<typename T>
concept Integral = __is_same_as(T, int);
template<int N>
concept Nonnegative = N >= 0;
template<typename... Args>
concept UnaryPack = (sizeof...(Args) == 1);
template<typename... Args>
requires Integral<Args...> // { dg-error "non-pack parameter" }
void f1();
template<typename... Args>
requires Integral<Args>... // { dg-error "parameter packs not expanded|expected unqualified-id" }
void f2();
template<typename... Args>
requires (Integral<Args> && ...)
void f3() { }
template<Integral... Args>
void f4() { }
// FIXME: This syntax is likely to be made invalid.
template<Nonnegative... Args> // { dg-error "does not constrain a type" }
void f5() { }
template<UnaryPack Arg> // requires UnaryPack<Arg>
void f6() { }
template<UnaryPack... Args> // requires (... && UnaryPack<Args>)
void f7() { }
void driver()
{
f1<int, int>(); // { dg-error "" }
f3<int, int>();
f3<int, void>(); // { dg-error "" }
f4<int, int>();
f4<int, void>(); // { dg-error "" }
f7<int>();
f7<int, int>();
}
|