Slightly more reduced testcase:
--- gcc/testsuite/g++.dg/ipa/pr60419.C 2014-03-19 15:57:57.735114622 +0100 +++ gcc/testsuite/g++.dg/ipa/pr60419.C 2014-03-20 10:20:56.245365852 +0100 @@ -0,0 +1,68 @@ +// PR middle-end/60419 +// { dg-do compile } +// { dg-options "-O2" } + +struct J +{ + J (); + virtual void foo (int &, int); +}; + +struct D +{ + virtual void foo (J &) const; + void bar () + { + J p; + foo (p); + } +}; + +struct K : J, public D +{ +}; + +struct F +{ + K *operator->(); +}; + +struct N : public K +{ + void foo (int &, int); + void foo (J &) const {} +}; + +struct L +{ + F l; +}; + +struct M +{ + L *operator->(); +}; + +struct G +{ + G (); +}; + +M h; + +G::G () +try +{ + N f; + f.bar (); + throw; +} +catch (int) +{ +} + +void +baz () +{ + h->l->bar (); +}
Slightly more reduced testcase:
--- gcc/testsuite/ g++.dg/ ipa/pr60419. C 2014-03-19 15:57:57.735114622 +0100 g++.dg/ ipa/pr60419. C 2014-03-20 10:20:56.245365852 +0100
+++ gcc/testsuite/
@@ -0,0 +1,68 @@
+// PR middle-end/60419
+// { dg-do compile }
+// { dg-options "-O2" }
+
+struct J
+{
+ J ();
+ virtual void foo (int &, int);
+};
+
+struct D
+{
+ virtual void foo (J &) const;
+ void bar ()
+ {
+ J p;
+ foo (p);
+ }
+};
+
+struct K : J, public D
+{
+};
+
+struct F
+{
+ K *operator->();
+};
+
+struct N : public K
+{
+ void foo (int &, int);
+ void foo (J &) const {}
+};
+
+struct L
+{
+ F l;
+};
+
+struct M
+{
+ L *operator->();
+};
+
+struct G
+{
+ G ();
+};
+
+M h;
+
+G::G ()
+try
+{
+ N f;
+ f.bar ();
+ throw;
+}
+catch (int)
+{
+}
+
+void
+baz ()
+{
+ h->l->bar ();
+}