]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c++/53491 (ICE in build_target_expr_with_type, at cp/tree.c:587)
authorPaolo Carlini <paolo@gcc.gnu.org>
Sat, 26 May 2012 21:20:38 +0000 (21:20 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Sat, 26 May 2012 21:20:38 +0000 (21:20 +0000)
/cp
2012-05-26  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/53491
* tree.c (stabilize_expr): Handle exp of void type.

/testsuite
2012-05-26  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/53491
* g++.dg/parse/crash60.C: New.

From-SVN: r187917

gcc/cp/ChangeLog
gcc/cp/tree.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/crash60.C [new file with mode: 0644]

index 2bf548d06f8279d10fd87dc902e2caf6c650aef1..7cc173b27f27feebae031e51bf498026f655a882 100644 (file)
@@ -1,3 +1,8 @@
+2012-05-26  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/53491
+       * tree.c (stabilize_expr): Handle exp of void type.
+
 2012-05-26  Jason Merrill  <jason@redhat.com>
 
        PR c++/53220
index 7c59105b9ce09d4f21e438d3dd42ac28acc293c9..236180de7fd23fdf36f5cd2d633d8680b9ddf759 100644 (file)
@@ -3281,6 +3281,11 @@ stabilize_expr (tree exp, tree* initp)
 
   if (!TREE_SIDE_EFFECTS (exp))
     init_expr = NULL_TREE;
+  else if (VOID_TYPE_P (TREE_TYPE (exp)))
+    {
+      *initp = exp;
+      return void_zero_node;
+    }
   /* There are no expressions with REFERENCE_TYPE, but there can be call
      arguments with such a type; just treat it as a pointer.  */
   else if (TREE_CODE (TREE_TYPE (exp)) == REFERENCE_TYPE
index 5b3df3617cc73f2a04e3d6aacd7e8fa28df79c6e..95136c99c0325441ae587f7c943baaa87ea61b7d 100644 (file)
@@ -1,4 +1,9 @@
-2012-05-22  Jason Merrill  <jason@redhat.com>
+2012-05-26  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/53491
+       * g++.dg/parse/crash60.C: New.
+
+2012-05-26  Jason Merrill  <jason@redhat.com>
 
        PR c++/53220
        * c-c++-common/array-lit.c: New.
diff --git a/gcc/testsuite/g++.dg/parse/crash60.C b/gcc/testsuite/g++.dg/parse/crash60.C
new file mode 100644 (file)
index 0000000..e515396
--- /dev/null
@@ -0,0 +1,14 @@
+// PR c++/53491
+
+struct M
+{
+  void pop();
+};
+
+void foo()
+{
+  int result = 0;
+  M m;
+
+  result += m.pop();  // { dg-error "invalid operands|in evaluation" }
+}
This page took 0.076629 seconds and 5 git commands to generate.