aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2007-09-05 23:33:46 -0400
committerJason Merrill <jason@gcc.gnu.org>2007-09-05 23:33:46 -0400
commit86ef5ebb1e0b3fbb1587396b074be65a61623e85 (patch)
tree0071d13ad9499501172974d99b0ed377b76af9b2 /gcc
parent8c292a7298d84e0942957689aac056d2f9ccf627 (diff)
downloadgcc-86ef5ebb1e0b3fbb1587396b074be65a61623e85.zip
gcc-86ef5ebb1e0b3fbb1587396b074be65a61623e85.tar.gz
gcc-86ef5ebb1e0b3fbb1587396b074be65a61623e85.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/except.c3
-rw-r--r--gcc/testsuite/g++.dg/eh/spec9.C19
-rw-r--r--gcc/testsuite/g++.dg/ext/vla4.C2
4 files changed, 26 insertions, 1 deletions
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 <jason@redhat.com>
+ 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" }
}
}