blob: e70cdc0b2b0a080b55255d9312a3faba2c55800f (
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
|
// { dg-options "-std=c++1z -fconcepts" }
template<typename... Ts> struct are_same;
template<>
struct are_same<> {
static constexpr bool value = true;
};
template<typename T>
struct are_same<T> {
static constexpr bool value = true;
};
template<typename T, typename U, typename... Ts>
struct are_same<T, U, Ts...> {
static constexpr bool value =
__is_same_as(T, U) && are_same<U, Ts...>::value;
};
constexpr bool all_of() { return true; }
constexpr bool all_of(bool b) { return b; }
template<typename... Ts>
constexpr bool all_of(bool a, bool b, Ts... args) {
return (a && b) && all_of(b, args...);
}
template<typename... Ts>
concept bool C1 = are_same<Ts...>::value;
template<bool... Bs>
concept bool C2 = all_of(Bs...);
template<C1... Ts> struct S1 { };
template<C1...> struct S2 { };
template<C2... Bs> struct S4 { };
template<C2...> struct S5 { };
S1<int, int, int> s1;
S4<true, true, true> s4;
|