From 63752e29bbd7fb0d65e9acfbcf5d28715f497266 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 14 Nov 2005 15:07:45 -0500 Subject: [PATCH] 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 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/method.c | 4 +++- gcc/testsuite/g++.dg/eh/synth2.C | 24 ++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/eh/synth2.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5b5e78323a5..6d7260fb3b1 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 67e42ea1e0e..82f4a363cc2 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 00000000000..2da814db9d6 --- /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; +} -- 2.30.2