From: Jason Merrill Date: Mon, 14 Nov 2005 20:07:45 +0000 (-0500) Subject: re PR c++/24580 (virtual base class cause exception not to be caught) X-Git-Tag: releases/gcc-4.1.0~870 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=63752e29bbd7fb0d65e9acfbcf5d28715f497266;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: r106901 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5b5e78323a58..6d7260fb3b1d 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-11-14 Mark Mitchell * parser.c (eof_token): Add initializer for ambiguous_p. diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 67e42ea1e0ea..82f4a363cc2d 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -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 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; +}