aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp1z/pr83918.C
blob: cbeb6cc9ef985ffdb2fb0ac23aedcc1a4f375d17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// PR c++/83918
// { dg-do compile { target c++17 } }

constexpr unsigned
foo (unsigned x, unsigned y)
{
  return x > y ? x : y;
}

template <typename, typename> struct A;
template <auto ...> struct B;
template <auto S, auto ... T, auto U, auto ... V>
struct A <B <S, T...>, B <U, V...>>
{
  enum : unsigned
  {
    u = foo (sizeof (S), sizeof (U)),
    v = A <B <T...>, B <V...>>::w,
    w = foo (u, v)
  };
};

template <>
struct A <B <>, B <>>
{
  enum : unsigned { w = 0 };
};

constexpr static const auto v { A <B <1,2,3,4,5,6,7,8,9>,
				   B <9,8,7,6,5,4,3,2,1>>::w };
static_assert (v == sizeof (int));