re PR c++/11704 (ICE in type_dependent_expression_p with wrong method call in template class)

cp:
	PR c++/11704
	* pt.c (type_dependent_expression_p): Cope with COMPONENT_REF with
	unknown type.
testsuite:
	PR c++/11704
	* g++.dg/template/dependent-expr2.C: New test.

From-SVN: r70119
This commit is contained in:
Nathan Sidwell 2003-08-03 14:23:34 +00:00 committed by Nathan Sidwell
parent ae0b7dfc7e
commit 6cb893080b
4 changed files with 45 additions and 0 deletions

View File

@ -1,3 +1,13 @@
2003-08-03 Nathan Sidwell <nathan@codesourcery.com>
PR c++/11704
* pt.c (type_dependent_expression_p): Cope with COMPONENT_REF with
unknown type.
PR c++/11766
* typeck.c (comp_ptr_ttypes_real): Don't loop on pointers to
member functions.
2003-08-02 Nathan Sidwell <nathan@codesourcery.com>
PR c++/9447

View File

@ -11625,6 +11625,15 @@ type_dependent_expression_p (tree expression)
{
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)

View File

@ -1,5 +1,8 @@
2003-08-03 Nathan Sidwell <nathan@codesourcery.com>
PR c++/11704
* g++.dg/template/dependent-expr2.C: New test.
PR c++/11766
* g++.dg/expr/ptrmem1.C: New test.

View File

@ -0,0 +1,23 @@
// { 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" "" }
}
};