]> git.ipfire.org Git - thirdparty/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:48:50 +0000 (15:48 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 14 Nov 2005 20:48:50 +0000 (15:48 -0500)
        PR c++/24580
        * method.c (locate_ctor): Skip all artificial parms, not just
        'this'.

From-SVN: r106903

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

index 4f7b178d4185574d63086d09411cb1168725358d..beab029a9bb3a4fb851543a08d748b3f26be85b6 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-10-28  Josh Conner  <jconner@apple.com>
 
        PR c++/22153
index ef69c37fe4d7f8b26f5150dfd53e9420717ed432..6e7f5d8c110088c2ce4917533ee576ef5a52ff35 100644 (file)
@@ -896,7 +896,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;
+}