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 11704


Hi,
I've installed this to fix 11704. We can get a unresolved COMPONENT_REF
of unknown type.

booted & tested on i686-pc-linux-gnu.

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
         The voices in my head said this was stupid too
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

2003-08-03  Nathan Sidwell  <nathan@codesourcery.com>

	PR c++/11704
	* pt.c (type_dependent_expression_p): Cope with COMPONENT_REF with
	unknown type.

Index: cp/pt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.750
diff -c -3 -p -r1.750 pt.c
*** cp/pt.c	2 Aug 2003 11:01:37 -0000	1.750
--- cp/pt.c	2 Aug 2003 19:18:17 -0000
*************** type_dependent_expression_p (tree expres
*** 11627,11632 ****
--- 11627,11641 ----
  	return true;
        if (TREE_CODE (expression) == ADDR_EXPR)
  	return type_dependent_expression_p (TREE_OPERAND (expression, 0));
+       if (TREE_CODE (expression) == COMPONENT_REF)
+ 	{
+ 	  if (type_dependent_expression_p (TREE_OPERAND (expression, 0)))
+ 	    return true;
+ 	  expression = TREE_OPERAND (expression, 1);
+ 	  if (TREE_CODE (expression) == IDENTIFIER_NODE)
+ 	    return false;
+ 	}
+       
        if (TREE_CODE (expression) == BASELINK)
  	expression = BASELINK_FUNCTIONS (expression);
        if (TREE_CODE (expression) == TEMPLATE_ID_EXPR)
// { dg-do compile }

// Copyright (C) 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 2 Aug 2003 <nathan@codesourcery.com>

// PR 11704. ICE

struct A 
{
  int foo() 
  {
    return 5;
  }
};

template <class T> // If B is not template it works
struct B
{
  bool bar(A& a)
  {
    return a.foo == 0; // { dg-error "insufficient context" "" }
  }
};

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