From: Jason Merrill Date: Thu, 6 Sep 2007 03:33:46 +0000 (-0400) Subject: re PR c++/15745 (exception specification incorrectly changes the type of the exceptio... X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=86ef5ebb1e0b3fbb1587396b074be65a61623e85;p=platform%2Fupstream%2Fgcc.git re PR c++/15745 (exception specification incorrectly changes the type of the exception thrown) PR c++/15745 * except.c (prepare_eh_type): Use type_decays_to. From-SVN: r128174 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a32ecdb..6bcc3ef 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2007-09-05 Jason Merrill + PR c++/15745 + * except.c (prepare_eh_type): Use type_decays_to. + PR c++/15097 * init.c (build_delete): Use build_headof to get the address of the complete object if we aren't using the deleting destructor. diff --git a/gcc/cp/except.c b/gcc/cp/except.c index 199d185..38111b1 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -115,6 +115,9 @@ prepare_eh_type (tree type) /* Peel off cv qualifiers. */ type = TYPE_MAIN_VARIANT (type); + /* Functions and arrays decay to pointers. */ + type = type_decays_to (type); + return type; } diff --git a/gcc/testsuite/g++.dg/eh/spec9.C b/gcc/testsuite/g++.dg/eh/spec9.C new file mode 100644 index 0000000..9e00d1c --- /dev/null +++ b/gcc/testsuite/g++.dg/eh/spec9.C @@ -0,0 +1,19 @@ +// PR c++/15745 +// { dg-do run } + +typedef int IntArray[10]; +IntArray i; + +void test_array() throw (IntArray) +{ + throw i; +} + +int main () +{ + try + { + test_array(); + } + catch (IntArray) {} +} diff --git a/gcc/testsuite/g++.dg/ext/vla4.C b/gcc/testsuite/g++.dg/ext/vla4.C index 8b7f38f..ecec908 100644 --- a/gcc/testsuite/g++.dg/ext/vla4.C +++ b/gcc/testsuite/g++.dg/ext/vla4.C @@ -7,7 +7,7 @@ void f(int i) { try { int a[i]; throw &a; // { dg-error "variable size" } - } catch (int (&)[i]) { // { dg-error "variable size" } + } catch (int (*)[i]) { // { dg-error "variable size" } } }