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]

Re: PR c++/30195


On 10/24/2011 05:53 PM, Fabien Chêne wrote:
After looking into it a bit more, I now see things differently. The
target_decl is in fact put into the CLASSTYPE_METHOD_VEC at
instantiation time, via handle_using_decl, with the correct access.

Great.


The problem is that while parsing the template (before instantiating),
it is not yet there and an error is immediately raised.

Ah, I see. We need lookup_member to find the USING_DECL, but if we're skipping function USING_DECLs in lookup_field_1 and they aren't in CLASSTYPE_METHOD_VEC in templates, we don't find it either way.


I only see three solutions:
1) perform an additional lookup for using declarations that designate
functions in lookup_fnfields_slot to find something even if the
CLASSTYPE_METHOD_VEC is empty (what I implemented in the previous
patch)
2) inhibate the lookup error at some point.
3) put the decl into the CLASSTYPE_METHOD_VEC before instantiation

Honestly, I don't know if 2) is realistic, and how to implement it as well ...
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? 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.


Jason


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