From: Jason Merrill Date: Mon, 14 Nov 2005 20:48:50 +0000 (-0500) Subject: re PR c++/24580 (virtual base class cause exception not to be caught) X-Git-Tag: releases/gcc-3.4.5~77 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a712e7b0ebd24933964f7e9b975694bea9ad653;p=thirdparty%2Fgcc.git re PR c++/24580 (virtual base class cause exception not to be caught) PR c++/24580 * method.c (locate_ctor): Skip all artificial parms, not just 'this'. From-SVN: r106903 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4f7b178d4185..beab029a9bb3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2005-11-14 Jason Merrill + + PR c++/24580 + * method.c (locate_ctor): Skip all artificial parms, not just + 'this'. + 2005-10-28 Josh Conner PR c++/22153 diff --git a/gcc/cp/method.c b/gcc/cp/method.c index ef69c37fe4d7..6e7f5d8c1100 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -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 index 000000000000..2da814db9d63 --- /dev/null +++ b/gcc/testsuite/g++.dg/eh/synth2.C @@ -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; +}