[prev in list] [next in list] [prev in thread] [next in thread]
List: gcc-patches
Subject: [patch] Fix PR c++/29291: ICE on invalid use of new
From: reichelt () igpm ! rwth-aachen ! de
Date: 2006-09-29 20:54:23
Message-ID: 33140.87.78.66.159.1159563263.squirrel () www ! igpm ! rwth-aachen ! de
[Download RAW message or body]
The following invalid code snippet triggers an ICE since GCC 4.2.0:
template<int> void foo()
{
new int(;
}
bug.cc: In function 'void foo()':
bug.cc:3: error: expected primary-expression before ';' token
bug.cc:3: internal compiler error: tree check: expected tree_list, have
error_mark in any_type_dependent_arguments_p, at cp/pt.c:13017
Please submit a full bug report, [etc.]
This is similar to PR 28593, and so is the fix: The patch just improves
the sanity checks at the beginning of build_new.
Bootstrapped and regtested on i686-pc-linux-gnu.
Ok for mainline?
Regards,
Volker
:ADDPATCH C++:
2006-09-26 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/29291
* init.c (build_new): Check for invalid init.
===================================================================
--- gcc/gcc/cp/init.c 2006-09-27 04:20:35 +0200
+++ gcc/gcc/cp/init.c 2006-09-27 04:20:22 +0200
@@ -2075,7 +2075,8 @@ build_new (tree placement, tree type, tr
tree orig_nelts;
tree orig_init;
- if (placement == error_mark_node || type == error_mark_node)
+ if (placement == error_mark_node || type == error_mark_node
+ || init == error_mark_node)
return error_mark_node;
orig_placement = placement;
===================================================================
2006-09-26 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/29291
* g++.dg/parse/new4.C: New test.
===================================================================
--- gcc/gcc/testsuite/g++.dg/parse/new4.C 2003-09-23 19:59:22 +0200
+++ gcc/gcc/testsuite/g++.dg/parse/new4.C 2006-09-27 04:32:02 +0200
@@ -0,0 +1,7 @@
+// PR c++/29291
+// { dg-do compile }
+
+template<int> void foo()
+{
+ new int(; // { dg-error "before" }
+}
===================================================================
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic