c++: change -fconcepts to mean C++20 concepts
[official-gcc.git] / gcc / testsuite / g++.dg / concepts / variadic2.C
blob1776b951113e6b092721d58e3ac810bf752f5e25
1 // { dg-do compile { target c++17_only } }
2 // { dg-options "-fconcepts-ts" }
4 template <class T> concept bool Copyable = requires (T t) { T(t); };
5 template <class T> concept bool Constructable = requires { T(); };
6 template <class T> concept bool Both = Copyable<T> && Constructable<T>;
8 template <Copyable... Ts> // requires (Copyable<Ts> && ...)
9 constexpr int f(Ts...) { return 0; } // #1
11 template <Both... Ts> // requires (Both<Ts> && ...)
12 constexpr int f(Ts...) { return 1; }     // #2
14 int main()
16   static_assert(f(42) == 1); // { dg-error "ambiguous" }
17   // The associated constraints of the two functions are incomparable.