https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79267
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Turned out to be easier to fix up all the errors in the reduced testcase manually and rereduce. There are still warnings about missing return statements in functions returning non-void, fixing those makes the ICE go away. struct A { A (int); }; struct B { virtual void av () = 0; void aw (); void h () { av (); aw (); } }; template <class ax> struct G : B { ax ba; G (int, ax) : ba (0) {} void av () { ba (0); } }; struct I { B *bc; template <class j, class ax> I (j, ax) try { G<ax> (0, 0); } catch (...) {} ~I () { bc->h (); } }; template <class m> struct C { typedef m *i; }; template <class m> struct J { J (); template <class o, class ax> J (o, ax p2) : be (0, p2) {} typename C<m>::i operator-> (); I be; }; struct H : A { H () : A (0) {} }; struct D { J<int> d; void q (); }; template <typename = int> class bs; int z; void fn1 (int p1, int *, int) { switch (p1) case 0: throw H (); } D fn2 (); template <typename bm> struct L { struct K { K (int); void operator() (int *) { fn2 ().q (); } }; static J<bm> bp () { bq (0); } template <typename br> static void bq (br) { J<bm> (0, K (0)); } }; struct F { virtual J<int> x (int) { fn1 (0, 0, 0); J<bs<> > (L<bs<> >::bp ()); } }; void fn3 () { if (z) { J<F> d, e; d->x (0); e->x (0); } J<F> v, i, j; v->x (0); i->x (0); j->x (0); }