This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++ PATCH: Fix PR/7504


This patchlet fixes the ICE reported in C++ PR/7504, a regression from 
GCC-2.95.x.  We were failing to check that a class-name has an actual
potential scope before looking into it.

OK for mainline, and later for branch?

-- Gaby

2002-08-15  Gabriel Dos Reis  <gdr@nerim.net>

	* parse.y (parse_finish_call_expr): Handle incomplete
	type used to name a scope.

Index: cp/parse.y
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/parse.y,v
retrieving revision 1.277
diff -p -r1.277 parse.y
*** cp/parse.y	11 Aug 2002 18:30:24 -0000	1.277
--- cp/parse.y	15 Aug 2002 00:08:21 -0000
*************** parse_finish_call_expr (tree fn, tree ar
*** 4133,4139 ****
  	    fn = lookup_namespace_name (scope, name);
  	  else
  	    {
! 	      if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
  		{
  		  template_id = name;
  		  template_args = TREE_OPERAND (name, 1);
--- 4133,4145 ----
  	    fn = lookup_namespace_name (scope, name);
  	  else
  	    {
! 	      if (!COMPLETE_TYPE_P (scope) && !TYPE_BEING_DEFINED (scope))
! 		{
! 		  error ("incomplete type '%T' cannot be used to name a scope",
! 			 scope);
! 		  return error_mark_node;
! 		}
! 	      else if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
  		{
  		  template_id = name;
  		  template_args = TREE_OPERAND (name, 1);
Index: testsuite/g++.dg/expr/member-of-incomplete-type-1.C
===================================================================
RCS file: testsuite/g++.dg/expr/member-of-incomplete-type-1.C
diff -N testsuite/g++.dg/expr/member-of-incomplete-type-1.C
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/expr/member-of-incomplete-type-1.C	15 Aug 2002 00:08:22 -0000
***************
*** 0 ****
--- 1,12 ----
+ // Copyright (C) 2002 Free Software Foundation
+ // Origin: jmr@fulcrummicro.com
+ // Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
+ 
+ 
+ struct A;
+ 
+ int main()
+ {
+     A::g();           // { dg-error "incomplete" "" }
+ }
+ 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]