https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81917
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |ice-on-valid-code Last reconfirmed|2017-08-22 00:00:00 |2019-6-24 --- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> --- FWIW a user has sent me an ice-on-valid reproducer for this as well. After reduce it's: template <int a> struct b { static constexpr int c = a; }; template <bool e> using d = b<e>; template <int> struct h { template <typename g, typename> using f = g; }; template <bool, typename i> using j = i; template <typename> using k = void; template <template <class...> class l> struct r { template <typename... n> using f = l<n...>; }; template <typename o, typename... p> using aa = typename o::template f<p...>; template <typename g> struct s { template <typename... q> using f = aa<g, q...>; }; template <typename m, typename o> struct t { template <typename... p> using f = typename h<sizeof...( p)>::template f<o, void>::template f<typename m::template f<p>...>; }; template <typename o, typename... p> struct ab { template <typename... q> using f = typename o::template f<q..., p...>; }; template <typename o, typename... p> struct ac { template <typename... q> using f = typename o::template f<p..., q...>; }; template <typename... n> using ad = ab<r<ac>, n...>; struct ae; struct v { template <typename... af> using f = t<ad<ae>, r<s>>::f<af...>; }; template <typename, template <typename...> class, class...> struct IsValidT_impl {}; template <template <typename...> class g, typename... p> struct IsValidT_impl<k<g<p...>>, g, p...> : d<true> {}; struct w { template <template <typename...> class g, class... p> using f = IsValidT_impl<void, g, p...>; }; template <template <class> class ag> struct x { template <typename... g> using f = ag<g...>; }; template <typename, typename, typename, typename ah, typename... ai> struct y : aa<v, ai...>::template f<int> { using aj = aa<ah, ae>; aj ak(); }; namespace f { template <typename g, typename al> using am = decltype(g().ak().an(0, al())); struct z { template <typename g> friend auto operator==(j<w::f<am, ae, g>::c, ae>, g) {} template <typename g> friend auto operator==(g, j<w::f<am, ae, g>::c, ae>) {} }; template <typename, typename> struct ao : z {}; } // namespace f using ap = r<f::ao>; struct aq { template <typename ar, typename as> auto an(ar at, as au) { return at == au; } }; namespace av { template <typename> struct aw : aq {}; } // namespace av using ax = x<av::aw>; namespace ay { template <typename> struct az : aa<ax, int> {}; } // namespace ay using u = x<ay::az>; namespace ba { template <typename> struct bb : aa<u, int> {}; } // namespace ba using bc = x<ba::bb>; struct ae : y<int, int, int, bc, ap> {}; int main() { ae a; a == 0; } This compiles OK since r257542 but still fails with GCC 7: 81917.ii: In instantiation of 'struct IsValidT_impl<void, f::am, ae, ae>': 81917.ii:49:37: required by substitution of 'template<class g> auto f::operator==(g, j<IsValidT_impl<void, f::am, ae, g>::c, ae>) [with g = ae]' 81917.ii:72:8: required from here 81917.ii:32:8: error: redefinition of 'struct IsValidT_impl<void, f::am, ae, ae>' struct IsValidT_impl<k<g<p...>>, g, p...> : d<true> {}; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 81917.ii:32: confused by earlier errors, bailing out Is the fix safe to backport to gcc-7-branch?