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