https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92723
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Slightly adjusted, so that there are no warnings on it, with -O2 -std=c++17 -Wall -W when it compiles successfully, and with s/O2/O3/ when there is the ICE: template <typename> struct d; template <typename e> struct d<e &> { typedef e g; }; template <typename e> struct ac { typedef typename d<e>::g g; }; template <typename e> using af = typename ac<e>::g; template <bool, typename, typename ae> using ah = ae; struct aj { template <typename h, typename... ak> void al(h *, ak... an) { h(an...); } }; template <typename> using ao = aj; template <typename> class allocator : public ao<int> {}; template <typename> struct ap; template <typename e> struct ap<allocator<e>> { using aq = allocator<e>; template <typename h, typename... ak> static void al(aq ar, h am, ak... an) { ar.al(am, an...); } }; struct as { as(allocator<int>); }; template <typename> struct at { allocator<int> av; }; template <typename e, typename aw> struct ax { struct ay : as { ay(aw ar) : as(ar) {} }; template <typename... ak> ax(aw ar, ak... an) : az(ar) { ap<aw>::al(ar, ba(), an...); } e *ba(); ay az; }; struct bb { template <typename e, typename aw, typename... ak> bb(e *, at<aw> ar, ak... an) { ax<e, aw>(ar.av, an...); } }; template <typename e> struct au { using bc = e; template <typename aw, typename... ak> au(aw bd, ak... an) : be(ba, bd, an...) {} bc *ba = nullptr; bb be; }; template <typename e> struct bf : au<e> { template <typename aw, typename... ak> bf(aw bd, ak... an) : au<e>(bd, an...) {} template <typename bg, typename aw, typename... ak> friend bf<bg> bh(const aw &, ak &&...); }; template <typename e, typename aw, typename... ak> bf<e> bh(const aw &, ak &&... an) { bf<e>(at<aw>{}, an...); for (;;); } template <typename e, typename... ak> void bi(ak... an) { bh<e>(allocator<int>(), an...); } template <typename> constexpr bool bj = false; class j; struct bk { j *operator->(); }; struct bn : public bk { bn(decltype(nullptr)); }; class br; template <typename> using bp = br; template <typename bq, typename bu> bq bs(bu); template <typename bt> bt *bx(); using bv = struct bw { template <typename cb> void by() { int bz = 0; cb::ca(bz); } }; struct cf { using cc = int; }; struct cd { char k; void ce(); }; struct br : public cd { int &operator[](long l) { int *cj = reinterpret_cast<int *>(k); return cj[l]; } }; struct m { using cc = int; }; template <typename> constexpr bool n = false; struct j { using cg = int; using q = bp<cg>; q o(); } ch; template <typename... r, typename ci> bool cn(ci f) { ((bs<r *>(ch) ? f(*bs<r *>(ch)) : false) || ...); return false; } template <typename ck> struct p { using cl = int; static void co(bp<int> a, int b, bp<cl> c) { a.ce(); for (long i = 0; i < 8; ++i) c[i] = ck::apply(a[i], b); } }; template <template <typename, typename> class ck> struct cw { template <typename ci> bool da(ci f) { cn<cf, m>(f); return false; } template <typename ci> bool cy(ci f) { da([&](auto cz) { return da([&](auto dg) { return f(cz, dg); }); }); return false; } static bv ca(int bz) { bi<cw>(bz); return bv(); } cw(long) { cy([](auto &db, auto &de) { using cx = af<decltype(db)>; using cr = af<decltype(de)>; using cv = typename cx::cc; using cu = typename cr::cc; using dd = ah<bj<cv>, cv, j>; using dl = ah<n<int>, int, p<ck<cv, cu>>>; bn df = nullptr; auto di = df->o(); if (auto dh = bx<dd>()) dl::co(dh->o(), 0, di); return false; }); } }; template <typename, typename> struct s { using cl = unsigned long; template <typename dj = cl> static dj apply(int a, int b) { return dj(a)>> b | dj(a) <<(sizeof(dj) * 8 - b); } }; using t = cw<s>; bw dn; void dm() { dn.by<t>(); }