1 // { dg-options "-std=c++17 -fconcepts" } 2 3 template<typename... Ts> struct are_same; 4 5 template<> 6 struct are_same<> { 7 static constexpr bool value = true; 8 }; 9 10 template<typename T> 11 struct are_same<T> { 12 static constexpr bool value = true; 13 }; 14 15 template<typename T, typename U, typename... Ts> 16 struct are_same<T, U, Ts...> { 17 static constexpr bool value = 18 __is_same_as(T, U) && are_same<U, Ts...>::value; 19 }; 20 21 constexpr bool all_of() { return true; } 22 constexpr bool all_of(bool b) { return b; } 23 24 template<typename... Ts> 25 constexpr bool all_of(bool a, bool b, Ts... args) { 26 return (a && b) && all_of(b, args...); 27 } 28 29 template<typename... Ts> 30 concept bool C1 = are_same<Ts...>::value; 31 32 template<bool... Bs> 33 concept bool C2 = all_of(Bs...); 34 35 template<C1... Ts> struct S1 { }; 36 template<C1...> struct S2 { }; 37 template<C2... Bs> struct S4 { }; 38 template<C2...> struct S5 { }; 39 40 S1<int, int, int> s1; 41 S4<true, true, true> s4; 42