This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ PATCH] Fix ice-on-invalid calling get_unwidened (error_mark_node, ) (PR c++/32567)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 21 Aug 2007 14:25:56 -0400
- Subject: [C++ PATCH] Fix ice-on-invalid calling get_unwidened (error_mark_node, ) (PR c++/32567)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
On the following testcase the FE is calling get_unwidened on
error_mark_node. As that is not a FE routine, but used by the tree
optimizers as well, I think it is better to avoid calling it with
error_mark_node instead of changing get_unwidened to pass through
error_mark_node.
Ok for trunk?
2007-08-21 Jakub Jelinek <jakub@redhat.com>
PR c++/32567
* typeck.c (build_unary_op) <case PREINCREMENT_EXPR>: Return
error_mark_node right away if build_expr_type_conversion
returned it.
--- gcc/cp/typeck.c.jj 2007-08-21 08:13:43.000000000 +0200
+++ gcc/cp/typeck.c 2007-08-21 19:31:44.000000000 +0200
@@ -4259,6 +4259,8 @@ build_unary_op (enum tree_code code, tre
errstring ="no post-decrement operator for type";
break;
}
+ else if (arg == error_mark_node)
+ return error_mark_node;
/* Report something read-only. */
--- gcc/testsuite/g++.dg/parse/crash36.C.jj 2007-08-21 19:33:27.000000000 +0200
+++ gcc/testsuite/g++.dg/parse/crash36.C 2007-08-21 19:38:31.000000000 +0200
@@ -0,0 +1,11 @@
+// PR c++/32567
+// { dg-do compile }
+// { dg-options "-std=c++98" }
+
+template <typename... T> struct A // { dg-error "does not include variadic templates" }
+{
+ static T &t; // { dg-error "not expanded with|T" }
+ static const int i = sizeof (++t); // { dg-error "invalid use of template type parameter" }
+};
+
+int x[A <int>::i]; // { dg-error "is not an integral constant-expression" }
Jakub