145
|
1 // { dg-do compile { target c++17_only } }
|
131
|
2 // { dg-options "-fconcepts" }
|
111
|
3
|
|
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>;
|
|
7
|
145
|
8 template <Copyable... Ts> // requires (Copyable<Ts> && ...)
|
111
|
9 constexpr int f(Ts...) { return 0; } // #1
|
|
10
|
145
|
11 template <Both... Ts> // requires (Both<Ts> && ...)
|
111
|
12 constexpr int f(Ts...) { return 1; } // #2
|
|
13
|
|
14 int main()
|
|
15 {
|
145
|
16 static_assert(f(42) == 1); // { dg-error "ambiguous" }
|
|
17 // The associated constraints of the two functions are incomparable.
|
111
|
18 }
|