2011/10/11 Jason Merrill <ja...@redhat.com>:
> On 10/10/2011 03:56 PM, Fabien Chêne wrote:
>>
>> It tried to add the target declaration of a USING_DECL in the
>> method_vec of the class where the USING_DECL is declared. Thus, I
>> copied the target decl, adjusted its access, and then called
>> add_method with the target decl.
>
> Copying the decl is unlikely to do what we want, I think.  Does putting the
> target decl directly into the method vec work?

Unfortunately not, it ends up with the same error: undefined
reference. Furthermore, I don't think it is the right approach since
the access may be different between the member function and the using
declaration... Never mind.

> If not, perhaps lookup_fnfields_1 should look through the field list for 
> function
> USING_DECLs.

That's what I've tried first, and it works. Though, I guess you mean
lookup_field_r should perform an additional lookup if
lookup_fnfields_1 does not find anything.

The attached patch implement that, and eventually fixed c++/26256,
c++/25994, c++/30195, c++/6936.
tested x86_64-unknown-linux-gnu without new regressions.

gcc/ChangeLog

2011-10-11  Fabien Chêne  <fab...@gcc.gnu.org>

        PR c++/6936
        PR c++/25994
        PR c++/26256
        PR c++/30195
        * dbxout.c (dbxout_type_fields): Ignore using declarations.


gcc/testsuite/ChangeLog

2011-10-11  Fabien Chêne  <fab...@gcc.gnu.org>

        PR c++/6936
        PR c++/25994
        PR c++/26256
        PR c++/30195
        * g++.dg/lookup/using23.C: New.
        * g++.dg/lookup/using24.C: New.
        * g++.dg/lookup/using25.C: New.
        * g++.dg/lookup/using26.C: New.
        * g++.dg/lookup/using27.C: New.
        * g++.dg/lookup/using28.C: New.
        * g++.dg/lookup/using29.C: New.
        * g++.dg/lookup/using30.C: New.
        * g++.dg/lookup/using31.C: New.
        * g++.dg/lookup/using32.C: New.
        * g++.dg/lookup/using33.C: New.
        * g++.dg/lookup/using34.C: New.
        * g++.dg/lookup/using35.C: New.
        * g++.dg/lookup/using36.C: New.
        * g++.dg/lookup/using37.C: New.
        * g++.dg/lookup/using38.C: New.
        * g++.dg/debug/using4.C: New.
        * g++.dg/debug/using5.C: New.
        * g++.dg/cpp0x/forw_enum10.C: New.
        * g++.old-deja/g++.other/using1.C: Adjust.
        * g++.dg/template/using2.C: Likewise.

gcc/cp/ChangeLog

2011-10-11  Fabien Chêne  <fab...@gcc.gnu.org>

        PR c++/6936
        PR c++/25994
        PR c++/26256
        PR c++/30195
        * search.c (lookup_field_1): Get rid of the comment saying that
        USING_DECL should not be returned, and actually return USING_DECL
        if appropriate.
        (lookup_field_r): Call lookup_fnfields_slot with LOOKUP_USING=true
        instead of lookup_fnfields_1.
        (lookup_fnfields_slot): add a new parameter LOOKUP_USING, and
        perform an additional lookup for USING_DECLs targeting functions
        if LOOKUP_USING is set to true.
        * semantics.c (finish_member_declaration): Remove the check that
        prevents USING_DECLs from being verified by pushdecl_class_level.
        * typeck.c (build_class_member_access_expr): Handle USING_DECLs.
        * class.c (check_field_decls): Keep using declarations.
        (add_method): Remove a wrong diagnostic about conflicting using
        declarations.
        (type_has_move_assign): Call lookup_fnfields_slot with
        LOOKUP_USING set to false.
        * parser.c (cp_parser_nonclass_name): Handle USING_DECLs.
        * decl.c (start_enum): Call xref_tag whenever possible.
        * name-lookup.c (strip_using_decl): New function.
        (supplement_binding_1): Call strip_using_decl on decl and
        bval. Perform most of the checks with USING_DECLs stripped.  Also
        check that the target decl and the target bval does not refer to
        the same declaration. Allow pushing an enum multiple times in a
        template class.
        (push_class_level_binding): Call strip_using_decl on decl and
        bval. Perform most of the checks with USING_DECLs stripped. Return
        true if both decl and bval refer to USING_DECLs and are dependent.
        * call.c (build_user_type_conversion_1): Call lookup_fnfields_slot
        with LOOKUP_USING set to false.

-- 
Fabien

Attachment: using.patch
Description: Binary data

Reply via email to