2011/10/27 Jason Merrill <ja...@redhat.com>:
[...]
>> 3) seems complicated: in finish_member_declaration, we must put away
>> the decl into TYPE_FIELDS or TYPE_METHODS, but we would like to put
>> the target_decl into TYPE_METHODS (and call add_method), and at the
>> same time put its  using decl into TYPE_FIELDS... I don't know if it
>> can theoretically work, but having try it, I think it would need many
>> adjustments.
>
> I think #3 is the way to go.  Isn't that what happens in non-templates?

In non-templates, I think the target member function is put into the
method_vec via handle_using_decl.

> We don't try to instantiate the CLASSTYPE_METHOD_VEC, we build up a whole new
> one from the decl list, so having it in both places shouldn't be a problem
> for instantiation.

OK, it wasn't that hard in fact. I just had to remove the code that
was diagnosing using re-declaration (in handle_using_decl) and adjust
push_class_level_binding_1 so that supplement_binding diagnose a name
conflict.

While doing that, I realised that most of the diagnostics about name
conflicts, are now done in supplement_binding, which is good. The bad
side effect is that the common diagnostic is somewhat poor:
error ("declaration of %q#D", decl);
error ("conflicts with previous declaration %q+#D", bval);

Beyond the fact that it raises two errors instead of an error plus an
inform, it mentions declaration even if it is actually a definition.
Also, it I think that it would be good to keep the concept of
'redeclaration'.
Consequently, I think the current patch is not good enough without
that. Would you be OK with the changes suggested above ?

-- 
Fabien

Reply via email to