https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108967
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Somewhat reduced for -O2 -g:
template <int N>
struct A {
using T = unsigned short;
static constexpr int a = N;
};
template <int N>
struct B { using type = A<N>; };
struct C {
static constexpr int N = 16 / sizeof (short);
using type = B<N>::type;
};
template <typename, int, int> using D = C::type;
template <class U> using E = typename U::T;
template <typename, int> struct F {
unsigned short r[16 / sizeof(short)];
};
template <class U>
F<E<U>, U::a> baz (U);
template <class U>
using G = decltype(baz (U ()));
template <class U, typename T>
G<U> qux (U, T);
template <typename T, int N>
F<T, N>
boo (F<T, N> b)
{
F<T, N> a;
for (int i = 0; i < N; ++i)
a.r[i] = a.r[i] + b.r[i] < T(-1) ? a.r[i] + b.r[i] : T(-1);
return a;
}
void corge (G<A<8>>);
template <class U, class V>
void
freddy (U, V v, V)
{
corge (v);
}
template <int U, class V, int W>
struct H {
static void garply (int, int) { D<int, U, W> d; V() (int(), d); }
};
struct I;
template <int W = 1>
struct J {
template <typename T>
void operator () (T) { int m = 1; H<int{}, I, W>::garply (1, m); }
};
struct K {
void operator () (short t) { J() (t); }
};
struct I {
template <class T, class U>
void
operator () (T, U d)
{
auto a = qux (d, T()), b = qux (d, 0);
F c = boo (b);
freddy (d, c, a);
}
};
void
test ()
{
K k;
k (short ());
}