OSDN Git Service

cp/
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 20 Nov 2009 16:03:19 +0000 (16:03 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 20 Nov 2009 16:03:19 +0000 (16:03 +0000)
2009-11-20  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/42060
* except.c (build_throw): Check the tree returned by
decay_conversion for error_mark_node.

testsuite/
2009-11-20  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/42060
* g++.dg/cpp0x/initlist28.C: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154371 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/except.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/initlist28.C [new file with mode: 0644]

index b5b2b04..a4024ef 100644 (file)
@@ -1,3 +1,9 @@
+2009-11-20  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/42060
+       * except.c (build_throw): Check the tree returned by
+       decay_conversion for error_mark_node.
+
 2009-11-20  Shujing Zhao  <pearly.zhao@oracle.com>
 
        PR c++/29017
index 1b13819..66dc14e 100644 (file)
@@ -752,8 +752,12 @@ build_throw (tree exp)
            }
        }
       else
-       exp = build2 (INIT_EXPR, temp_type, object,
-                     decay_conversion (exp));
+       {
+         tmp = decay_conversion (exp);
+         if (tmp == error_mark_node)
+           return error_mark_node;
+         exp = build2 (INIT_EXPR, temp_type, object, tmp);
+       }
 
       /* Pre-evaluate the thrown expression first, since if we allocated
         the space first we would have to deal with cleaning it up if
index 4cc2378..de7ab00 100644 (file)
@@ -1,3 +1,8 @@
+2009-11-20  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/42060
+       * g++.dg/cpp0x/initlist28.C: New.
+
 2009-11-20  H.J. Lu  <hongjiu.lu@intel.com>
 
        * gfortran.dg/proc_ptr_comp_23.f90: Add a missing space.
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist28.C b/gcc/testsuite/g++.dg/cpp0x/initlist28.C
new file mode 100644 (file)
index 0000000..3b959a0
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/42060
+// { dg-options "-std=c++0x" }
+
+void foo()
+{
+  int a[1];
+  throw a = {}; // { dg-error "invalid use of non-lvalue array" }
+}