diff options
author | Jason Merrill <jason@redhat.com> | 2005-11-14 15:07:45 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2005-11-14 15:07:45 -0500 |
commit | 63752e29bbd7fb0d65e9acfbcf5d28715f497266 (patch) | |
tree | 47a4a9dd0b3a9124f944303cf55f661076130364 | |
parent | 8520690170c14805001693fe2fb88bc7b58a8cbf (diff) | |
download | gcc-63752e29bbd7fb0d65e9acfbcf5d28715f497266.zip gcc-63752e29bbd7fb0d65e9acfbcf5d28715f497266.tar.gz gcc-63752e29bbd7fb0d65e9acfbcf5d28715f497266.tar.bz2 |
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
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/method.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/eh/synth2.C | 24 |
3 files changed, 33 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5b5e783..6d7260f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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. diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 67e42ea..82f4a36 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 0000000..2da814d --- /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; +} |