aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/concepts/variadic2.C
blob: 4675d97ca1885c0164f433ec804b323b49e88d36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// { dg-do compile { target c++17 } }
// { dg-options "-fconcepts" }

template <class T> concept bool Copyable = requires (T t) { T(t); };
template <class T> concept bool Constructable = requires { T(); };
template <class T> concept bool Both = Copyable<T> && Constructable<T>;

template <Copyable... Ts>
constexpr int f(Ts...) { return 0; } // #1

template <Both... Ts>
constexpr int f(Ts...) { return 1; }     // #2

int main()
{
  static_assert(f(42) == 1);
}