Subject: re: toolchain/35082 (Internal compiler error while building "mjpegtools" package)
To: None <gnats-bugs@NetBSD.org>
From: matthew green <mrg@eterna.com.au>
List: netbsd-bugs
Date: 11/21/2006 15:48:22
please try this patch.  it works for me on macppc.

.mrg.



Index: gcc/testsuite/g++.dg/parse/pure1.C
===================================================================
--- gcc/testsuite/g++.dg/parse/pure1.C	(revision 117695)
+++ gcc/testsuite/g++.dg/parse/pure1.C	(revision 117694)
@@ -1,11 +0,0 @@
-// PR c++/28506
-
-struct A
-{
-  virtual void* foo() = 1; // { dg-error "pure" }
-};
-
-struct B
-{
-  void operator()()() = 1; // { dg-error "pure|function|initializer" }
-};
Index: gcc/cp/parser.c
===================================================================
--- gcc/cp/parser.c	(revision 117695)
+++ gcc/cp/parser.c	(revision 117694)
@@ -982,24 +982,6 @@ make_parameter_declarator (cp_decl_speci
   return parameter;
 }
 
-/* Returns true iff DECLARATOR  is a declaration for a function.  */
-
-static bool
-function_declarator_p (const cp_declarator *declarator)
-{
-  while (declarator)
-    {
-      if (declarator->kind == cdk_function
-	  && declarator->declarator->kind == cdk_id)
-	return true;
-      if (declarator->kind == cdk_id
-	  || declarator->kind == cdk_error)
-	return false;
-      declarator = declarator->declarator;
-    }
-  return false;
-}
- 
 /* The parser.  */
 
 /* Overview
@@ -3621,17 +3603,6 @@ cp_parser_nested_name_specifier_opt (cp_
 	{
 	  /* Grab the nested-name-specifier and continue the loop.  */
 	  cp_parser_pre_parsed_nested_name_specifier (parser);
-	  /* If we originally encountered this nested-name-specifier
-	     with IS_DECLARATION set to false, we will not have
-	     resolved TYPENAME_TYPEs, so we must do so here.  */
-	  if (is_declaration
-	      && TREE_CODE (parser->scope) == TYPENAME_TYPE)
-	    {
-	      new_scope = resolve_typename_type (parser->scope,
-						 /*only_current_p=*/false);
-	      if (new_scope != error_mark_node)
-		parser->scope = new_scope;
-	    }
 	  success = true;
 	  continue;
 	}
@@ -11079,7 +11050,8 @@ cp_parser_init_declarator (cp_parser* pa
   is_non_constant_init = true;
   if (is_initialized)
     {
-      if (function_declarator_p (declarator)
+      if (declarator->kind == cdk_function
+	  && declarator->declarator->kind == cdk_id
 	  && initialization_kind == CPP_EQ)
 	initializer = cp_parser_pure_specifier (parser);
       else
@@ -13738,7 +13710,8 @@ cp_parser_member_declaration (cp_parser*
 		     for a pure-specifier; otherwise, we look for a
 		     constant-initializer.  When we call `grokfield', it will
 		     perform more stringent semantics checks.  */
-		  if (function_declarator_p (declarator))
+		  if (declarator->kind == cdk_function
+		      && declarator->declarator->kind == cdk_id)
 		    initializer = cp_parser_pure_specifier (parser);
 		  else
 		    /* Parse the initializer.  */