public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: gcc-patches@gcc.gnu.org
Subject: [C++ PATCH] Fix ice-on-invalid calling get_unwidened (error_mark_node, ) (PR c++/32567)
Date: Tue, 21 Aug 2007 18:53:00 -0000	[thread overview]
Message-ID: <20070821182556.GO2063@devserv.devel.redhat.com> (raw)

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

             reply	other threads:[~2007-08-21 18:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-21 18:53 Jakub Jelinek [this message]
2007-08-24  1:14 ` Mark Mitchell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070821182556.GO2063@devserv.devel.redhat.com \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).