]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/15745 (exception specification incorrectly changes the type of the exceptio...
authorJason Merrill <jason@redhat.com>
Thu, 6 Sep 2007 03:33:46 +0000 (23:33 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 6 Sep 2007 03:33:46 +0000 (23:33 -0400)
        PR c++/15745
        * except.c (prepare_eh_type): Use type_decays_to.

From-SVN: r128174

gcc/cp/ChangeLog
gcc/cp/except.c
gcc/testsuite/g++.dg/eh/spec9.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/vla4.C

index a32ecdb1560497cbd8247d11ccdf78c4bd24a24b..6bcc3ef3cfedc79929c8f91c307902b315efe3d1 100644 (file)
@@ -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.
index 199d18574f0741c37ab31063b8a5349fd6509516..38111b16338407e3015a2a61cae7b9a32f96b9e9 100644 (file)
@@ -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 (file)
index 0000000..9e00d1c
--- /dev/null
@@ -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) {}
+}
index 8b7f38f8ba80f21bda926d0ee840f81918662eba..ecec908074d55f725d33743bf345753e70921d3f 100644 (file)
@@ -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" }
   }
 }