https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64538
Bug ID: 64538 Summary: [4.9/5 Regression] Devirt ICE in possible_polymorphic_call_targets Product: gcc Version: 4.9.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ipa Assignee: unassigned at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org struct A {}; template <typename> struct I; struct P { virtual ~P(); }; template <typename> struct B; struct J : P { friend I<B<double>>; virtual B<int> &foo(int); }; struct L : virtual J, virtual P {}; struct C { P &c; C(P &p1) : c(p1) {} }; template <typename B> struct I : C { typedef typename B::template F<0>::t R; J &c; I(J &p1) : C(p1), c(p1) {} R &bar(int) { c.foo(0); } }; template <int, typename T> struct K : A { typedef typename T::S S; bool baz(const int &, I<S> &p2, I<S> &p3); }; struct D { virtual void foo(); }; template <typename> struct B { template <int> struct F { typedef int t; }; }; struct M : P, virtual public J {}; struct N : public M, virtual L {}; struct O : public N, D { O(int); }; struct G { typedef B<double> S; template <int> struct H { typedef O t; }; }; template <int N, typename T> bool K<N, T>::baz(const int &, I<S> &p2, I<S> &p3) { typedef typename T::template H<0>::t W; typedef typename S::template F<0>::t R; W a(0); I<S> b(a); R &c = b.bar(0); } template struct K<0, G>; with -std=c++0x -O2 started to ICE with r201836 and while the exact spot where it ICEd changed several times, it continues to ICE with current 4.9 branch and latest trunk.