]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c++/24580 (virtual base class cause exception not to be caught)
authorJason Merrill <jason@redhat.com>
Mon, 14 Nov 2005 20:07:45 +0000 (15:07 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 14 Nov 2005 20:07:45 +0000 (15:07 -0500)
        PR c++/24580
        * method.c (locate_ctor): Skip all artificial parms, not just
        'this'.

From-SVN: r106901

gcc/cp/ChangeLog
gcc/cp/method.c
gcc/testsuite/g++.dg/eh/synth2.C [new file with mode: 0644]

index 5b5e78323a58f3542e703481d1f8970b5dbab926..6d7260fb3b1d07763a966a13084a2e68ab577095 100644 (file)
@@ -1,3 +1,9 @@
+2005-11-14  Jason Merrill  <jason@redhat.com>
+
+       PR c++/24580
+       * method.c (locate_ctor): Skip all artificial parms, not just
+       'this'.
+
 2005-11-14  Mark Mitchell  <mark@codesourcery.com>
 
        * parser.c (eof_token): Add initializer for ambiguous_p.
index 67e42ea1e0ea9139b76c467a17d8d0cb88508c68..82f4a363cc2daa707cec3e5b564dc2bff254a82b 100644 (file)
@@ -889,7 +889,9 @@ locate_ctor (tree type, void *client ATTRIBUTE_UNUSED)
       tree fn = OVL_CURRENT (fns);
       tree parms = TYPE_ARG_TYPES (TREE_TYPE (fn));
 
-      if (sufficient_parms_p (TREE_CHAIN (parms)))
+      parms = skip_artificial_parms_for (fn, parms);
+
+      if (sufficient_parms_p (parms))
        return fn;
     }
   return NULL_TREE;
diff --git a/gcc/testsuite/g++.dg/eh/synth2.C b/gcc/testsuite/g++.dg/eh/synth2.C
new file mode 100644 (file)
index 0000000..2da814d
--- /dev/null
@@ -0,0 +1,24 @@
+// PR c++/24580
+// { dg-do run }
+
+struct vbase {};
+
+struct foo : virtual vbase
+{
+  foo()
+  {
+    throw "exception in foo ctor";
+  }
+};
+
+struct bar :  public foo {};
+
+int main()
+{
+  try
+    {
+      bar a;
+    }
+  catch ( ... ) { }
+  return 0;
+}
This page took 0.074828 seconds and 5 git commands to generate.