* doc/invoke.texi: Document -std=c++17 and -std=gnu++17 and document
[official-gcc.git] / gcc / testsuite / g++.dg / concepts / template-parm6.C
blobeb4bb1670b153fb24d804fae14c16790a272a603
1 // { dg-options "-std=c++17 -fconcepts" }
3 template<typename... Ts> struct are_same;
5 template<>
6   struct are_same<> {
7     static constexpr bool value = true;
8   };
10 template<typename T>
11   struct are_same<T> {
12     static constexpr bool value = true;
13   };
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   };
21 constexpr bool all_of() { return true; }
22 constexpr bool all_of(bool b) { return b; }
24 template<typename... Ts>
25   constexpr bool all_of(bool a, bool b, Ts... args) {
26     return (a && b) && all_of(b, args...);
27   }
29 template<typename... Ts>
30   concept bool C1 = are_same<Ts...>::value;
32 template<bool... Bs>
33   concept bool C2 = all_of(Bs...);
35 template<C1... Ts> struct S1 { };
36 template<C1...> struct S2 { };
37 template<C2... Bs> struct S4 { };
38 template<C2...> struct S5 { };
40 S1<int, int, int> s1;
41 S4<true, true, true> s4;