re PR c++/26365 (ICE in finish_class_member_access_expr, at cp/typeck.c)

PR c++/26365
	* typeck.c (finish_class_member_access_expr): Robustify
	PR c++/26365
	* g++.dg/template/crash45.C: New test.

From-SVN: r112986
This commit is contained in:
Mark Mitchell 2006-04-16 18:12:41 +00:00 committed by Mark Mitchell
parent 8a9b2875db
commit e13d2b4e53
4 changed files with 30 additions and 8 deletions

View File

@ -1,3 +1,8 @@
2006-04-16 Mark Mitchell <mark@codesourcery.com>
PR c++/26365
* typeck.c (finish_class_member_access_expr): Robustify
2006-04-15 Kazu Hirata <kazu@codesourcery.com>
* Make-lang.in (cp/pt.o): Depend on vecprim.h.

View File

@ -2046,16 +2046,11 @@ finish_class_member_access_expr (tree object, tree name, bool template_p)
if (TREE_CODE (name) == SCOPE_REF)
{
/* A qualified name. The qualifying class or namespace `S' has
already been looked up; it is either a TYPE or a
NAMESPACE_DECL. The member name is either an IDENTIFIER_NODE
or a BIT_NOT_EXPR. */
/* A qualified name. The qualifying class or namespace `S'
has already been looked up; it is either a TYPE or a
NAMESPACE_DECL. */
scope = TREE_OPERAND (name, 0);
name = TREE_OPERAND (name, 1);
gcc_assert (CLASS_TYPE_P (scope)
|| TREE_CODE (scope) == NAMESPACE_DECL);
gcc_assert (TREE_CODE (name) == IDENTIFIER_NODE
|| TREE_CODE (name) == BIT_NOT_EXPR);
/* If SCOPE is a namespace, then the qualified name does not
name a member of OBJECT_TYPE. */
@ -2066,6 +2061,10 @@ finish_class_member_access_expr (tree object, tree name, bool template_p)
return error_mark_node;
}
gcc_assert (CLASS_TYPE_P (scope));
gcc_assert (TREE_CODE (name) == IDENTIFIER_NODE
|| TREE_CODE (name) == BIT_NOT_EXPR);
/* Find the base of OBJECT_TYPE corresponding to SCOPE. */
access_path = lookup_base (object_type, scope, ba_check, NULL);
if (access_path == error_mark_node)

View File

@ -1,3 +1,8 @@
2006-04-16 Mark Mitchell <mark@codesourcery.com>
PR c++/26365
* g++.dg/template/crash45.C: New test.
2006-04-16 Paul Thomas <pault@gcc.gnu.org>
PR fortran/26787

View File

@ -0,0 +1,13 @@
// PR c++/26365
struct A {};
namespace N
{
template<int> void foo();
}
void bar(A *p)
{
p->N::foo<0>; // { dg-error "not a member" }
}