https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87125

            Bug ID: 87125
           Summary: [9 Regression] ICE in tsubst_copy starting with
                    r261084
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

The following testcase ICEs with -std=c++17 starting with r261084 in
tsubst_copy:

typedef unsigned a;
template <typename b, b c> struct d {
  static constexpr b e = c;
  typedef d f;
  constexpr operator int() { return e; }
};
typedef d<bool, true> g;
template <typename...> struct h;
template <typename i, typename j> struct h<i, j> : j {};
template <typename b> struct k { typedef b f; };
struct l : d<bool, false> {};
template <typename> struct ab : d<bool, false> {};
template <typename> auto aa() -> decltype(0);
template <typename> struct m;
struct n : g {};
template <typename> struct o { typedef int f; };
template <typename> struct v { typedef int f; };
template <bool, typename> struct p;
template <typename b> struct p<true, b> { typedef b f; };
template <typename> class s;
struct q;
template <typename b, typename> struct ac : k<b> {};
template <bool, bool, typename...> struct ad;
struct ae {
  template <typename af, typename... ag>
  static ac<decltype(af()(aa<ag>...)), q> ah(int);
};
template <typename ai, typename... aj> struct ad<false, false, ai, aj...> : ae
{
  typedef decltype(ah<ai, aj...>(0)) f;
};
template <typename ai, typename... aj>
struct ak : ad<l::e, ab<typename v<ai>::f>::e, ai, aj...>::f {};
template <typename ai, typename... aj> struct s<ai(aj...)> : ak<ai, aj...> {};
template <typename...> class al;
template <typename b, b> struct am;
int an, ct, dc;
template <typename> class ao {};
template <typename> struct ap;
template <typename ai, typename... aq> struct ap<ai(aq...)> {
  template <typename ar, typename> using as = decltype(ao<typename
o<ar>::f>());
  template <typename af, typename, typename... at>
  using au = typename s<af(as<at, a>...)>::f;
  template <typename> using av = au<ai, a, aq...>;
  template <typename ag, typename aw = av<al<>>> aw operator()(ag);
};
template <typename> using ax = h<d<bool, false>, d<bool, __is_enum(int)>>;
template <int, typename ay, typename... az> struct ba {
  typedef ap<ay(az...)> f;
};
template <typename ay, typename... az>
typename ba<ax<ay>::e, ay, az...>::f bb(ay, az...);
template <typename> struct bc;
template <typename bd> using be = typename bd::f;
enum bf { bg };
constexpr bf bh(a, a) { return bg; }
template <a, typename bi, bf> struct bk { using f = bi; };
template <long... bl> using bn = am<unsigned long, bl...>;
template <a bm> using bo = be<bk<bm, bn<0>, bh(1, bm)>>;
template <typename bd> struct bp { using f = bd; };
template <template <typename> class bq, typename... br,
          template <typename> class bs = bq>
bp<bs<br...>> r(int);
template <template <typename> class bq> using bt = decltype(r<bq>(0));
template <template <typename> class bq, typename...> struct bj : bt<bq> {};
struct bu {
  template <class...> using bv = g;
};
template <bool...> using dd = n;
template <typename...> using bw = dd<>;
template <typename... bx> using t = be<bj<bu::bv, bx...>>;
template <typename> struct w;
template <typename> using u = int;
namespace z {
template <typename> struct bz;
}
using z::bz;
template <typename...> struct ca : g {};
template <typename...> using cb = be<ca<>>;
template <typename...> using cc = cb<>;
namespace x {
template <typename y> struct cd { using f = y; };
template <typename y, typename> class ce : be<cd<y>> {
  using cf = be<cd<y>>;
  using cf::f;
};
}
using x::ce;
template <typename, long> using cg = int;
template <typename, typename> struct ch;
template <typename... br, unsigned long... bl> struct ch<bc<br...>, bn<bl...>>
{
  template <typename by> constexpr ch(by) noexcept(bw<m<cg<br, bl>>...>::e);
};
template <typename... br> using ci = ch<bc<br...>, bo<sizeof...(br)>>;
template <typename... br> using cj = ce<ci<br>...>;
namespace ck {
struct cl;
struct cm;
}
struct cn : cj<ck::cl, ck::cm> {};
struct co {
  template <typename Pipeable> struct cp : Pipeable {};
};
template <typename cq, typename cr>
auto operator|(cq arg, cr cs) -> decltype(co::cp<cr>::cs(arg, cs));
struct cu {
  template <typename cv> auto cw(cv cx, long) -> decltype(cx.cw());
};
template <typename cy> using cz = u<decltype(cu::cw(cy(), 2))>;
template <typename cy> using da = bz<cz<cy>>;
struct iter_transform_view;
template <typename> struct db {
  template <typename bs = iter_transform_view, p<(cc<>()), int>::f = 0>
  da<bs> begin();
};
template <typename> using adaptor_cursor_t = cn;
template <typename, typename> struct de : db<int> {
  template <typename bs>
  void begin_cursor_(bs) noexcept(adaptor_cursor_t<bs>{aa<bs>});
  template <typename bs = int, p<(cc<>()), int>::f = 0>
  auto cw() -> decltype(begin_cursor_(bs()));
};
struct df {
  template <typename di> struct cp {
    template <typename... br, typename dj = di>
    static auto bb(br... dk) -> decltype(dj::bb(dk...));
  };
  template <typename dg> w<dg> operator()(dg);
} dl;
template <typename di> struct w {
  di dm;
  template <typename cv> using dn = t<cv>;
  template <typename cv, typename Vw, typename p<(dn<cv>()), int>::f = 0>
  static auto cs(cv cx, Vw) -> decltype(dm(cx));
  template <typename... br, typename dj = di>
  auto operator()(br... dk) -> decltype(dl(df::cp<dj>::bb(dm, dk...)));
};
struct iter_transform_view : de<int, int> {};
struct transform_fn {
  template <typename dg>
  static auto bb(transform_fn dh, dg) -> decltype(bb(dh, an, ct));
  template <typename, typename> using Concept = t<>;
  template <typename cv, typename dg,
            typename p<(Concept<cv, dg>()), int>::f = 0>
  iter_transform_view operator()(cv, dg);
};
w<transform_fn> dh;
void ApiWrapapplyAdminsList() {
  auto admins = dc | dh([] {});
  admins.begin();
}

This testcase is ice-on-invalid, but the original it was creduced from
https://bugzilla.redhat.com/show_bug.cgi?id=1622598#c0
is valid I believe (and with the PR87122 fix 8.x doesn't ICE on it and accepts
it).

Reply via email to