public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* C++ PATCH: Fix PR/7504
@ 2002-08-14 17:13 Gabriel Dos Reis
  0 siblings, 0 replies; only message in thread
From: Gabriel Dos Reis @ 2002-08-14 17:13 UTC (permalink / raw)
  To: gcc-patches; +Cc: mark, jason


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" "" }
+ }
+ 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-08-15  0:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-14 17:13 C++ PATCH: Fix PR/7504 Gabriel Dos Reis

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).