C++ PATCH: PR 25300

Mark Mitchell mark@codesourcery.com
Mon Dec 12 16:31:00 GMT 2005


This patch fixes an ICE-on-invalid regression by making sure that
error_mark_node as input to build_qualified_name results in
error_mark_node as output as well.

Tested on x86_64-unknown-linux-gnu, applied on the mainline and 4.1
branches.

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

2005-12-12  Mark Mitchell  <mark@codesourcery.com>

	PR c++/25300
	* tree.c (build_qualified_name): Return error_mark_node for
	erroneous input.

2005-12-12  Mark Mitchell  <mark@codesourcery.com>

	PR c++/25300
	* g++.dg/template/inherit.C: Do not use a generic error message.

Index: gcc/cp/tree.c
===================================================================
--- gcc/cp/tree.c	(revision 108393)
+++ gcc/cp/tree.c	(working copy)
@@ -817,6 +817,10 @@ tree
 build_qualified_name (tree type, tree scope, tree name, bool template_p)
 {
   tree t;
+  if (type == error_mark_node
+      || scope == error_mark_node
+      || name == error_mark_node)
+    return error_mark_node;
   t = build2 (SCOPE_REF, type, scope, name);
   QUALIFIED_NAME_IS_TEMPLATE (t) = template_p;
   return t;
Index: gcc/testsuite/g++.dg/template/inherit.C
===================================================================
--- gcc/testsuite/g++.dg/template/inherit.C	(revision 108393)
+++ gcc/testsuite/g++.dg/template/inherit.C	(working copy)
@@ -9,5 +9,5 @@ struct Z : X<int> { };
 int main()
 {
   Z z;
-  z.X::f();                     // { dg-error ".*" "" }
+  z.X::f();                     // { dg-error "template parameters" "" }
 }



More information about the Gcc-patches mailing list