This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++: ICE 61
- To: mark at codesourcery dot com
- Subject: Re: C++: ICE 61
- From: "Martin v. Loewis" <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Date: Tue, 10 Aug 1999 09:15:00 +0200
- CC: gcc-patches at gcc dot gnu dot org
- References: <37AA8685.FC2CB0A9@wserv.com><199908081432.QAA00358@mira.isdn.cs.tu-berlin.de> <19990808105205M.mitchell@codesourcery.com>
> I don't even quite believe this comment, but I think it's probably
> truish. Basically, the whole concept here needs more commentary: why
> do we have to re-lookup the name?
Your intuition was right: We don't have to. I've removed the lookup,
and nothing breaks. So I propose the patch below for the mainline; a
test case is also included.
For the branch, I'll submit a revised patch with better comments.
1999-08-10 Martin v. Loewis <martin@mira.isdn.cs.tu-berlin.de>
* lex.c (do_identifier): Remove unnecessary lookup of class field.
template<class T>
void value_type(T){}
template <class T>
struct B{
typedef T value_type;
};
template<class>class Vector{};
template<class T>
struct D:B<T>{
Vector<value_type> r;
};
Index: lex.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/lex.c,v
retrieving revision 1.130
diff -u -p -r1.130 lex.c
--- lex.c 1999/08/07 22:28:51 1.130
+++ lex.c 1999/08/09 17:59:56
@@ -3091,34 +3091,6 @@ do_identifier (token, parsing, args)
else
id = lastiddecl;
- /* Scope class declarations before global
- declarations. */
- if ((!id || is_global (id))
- && current_class_type != 0
- && TYPE_SIZE (current_class_type) == 0)
- {
- /* Could be from one of the base classes. */
- tree field = lookup_field (current_class_type, token, 1, 0);
- if (field == 0)
- ;
- else if (field == error_mark_node)
- /* We have already generated the error message.
- But we still want to return this value. */
- id = lookup_field (current_class_type, token, 0, 0);
- else if (TREE_CODE (field) == VAR_DECL
- || TREE_CODE (field) == CONST_DECL
- || TREE_CODE (field) == TEMPLATE_DECL)
- id = field;
- else if (TREE_CODE (field) != FIELD_DECL)
- my_friendly_abort (61);
- else
- {
- cp_error ("invalid use of member `%D'", field);
- id = error_mark_node;
- return id;
- }
- }
-
/* Do Koenig lookup if appropriate (inside templates we build lookup
expressions instead). */
if (args && !current_template_parms && (!id || is_global (id)))