Commit 86ef5ebb by Jason Merrill Committed by Jason Merrill

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
parent 8c292a72
2007-09-05 Jason Merrill <jason@redhat.com> 2007-09-05 Jason Merrill <jason@redhat.com>
PR c++/15745
* except.c (prepare_eh_type): Use type_decays_to.
PR c++/15097 PR c++/15097
* init.c (build_delete): Use build_headof to get the address of the * init.c (build_delete): Use build_headof to get the address of the
complete object if we aren't using the deleting destructor. complete object if we aren't using the deleting destructor.
......
...@@ -115,6 +115,9 @@ prepare_eh_type (tree type) ...@@ -115,6 +115,9 @@ prepare_eh_type (tree type)
/* Peel off cv qualifiers. */ /* Peel off cv qualifiers. */
type = TYPE_MAIN_VARIANT (type); type = TYPE_MAIN_VARIANT (type);
/* Functions and arrays decay to pointers. */
type = type_decays_to (type);
return type; return type;
} }
......
// 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) {}
}
...@@ -7,7 +7,7 @@ void f(int i) { ...@@ -7,7 +7,7 @@ void f(int i) {
try { try {
int a[i]; int a[i];
throw &a; // { dg-error "variable size" } throw &a; // { dg-error "variable size" }
} catch (int (&)[i]) { // { dg-error "variable size" } } catch (int (*)[i]) { // { dg-error "variable size" }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment