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: [Patch] PR c++/26256


... And the patch.

2010/11/15 Fabien Chêne <fabien.chene@gmail.com>:
> Hello,
>
> 2010/8/20 Jason Merrill <jason@redhat.com>:
>> On 08/18/2010 03:05 PM, Fabien Chêne wrote:
>>>
>>> +diagnose_conflicting_using_decls (tree decl, tree real_decl, tree
>>> using_decl)
>>
>> I don't think we need to have special code to check for clashes between
>> using decls and other decls; such collisions ought to be caught by the same
>> code that catches two data members with the same name. ?It looks like this
>> code in finish_member_declaration is preventing that:
>>
>>> ?/* Enter the DECL into the scope of the class. ?*/
>>> ?else if ((TREE_CODE (decl) == USING_DECL && !DECL_DEPENDENT_P (decl))
>>> ? ? ? ? ? || pushdecl_class_level (decl))
>>
>> What happens if you just remove the USING_DECL check here?
>
> Sounds like it was ?the right thing to do. I have had to modify a bit
> the parser in order to handle USING_DECLs.
> I also have modified supplement_binding() to handle USING_DECLs. It is
> a bit touchy, but it seems to work well.
> Please also double check that lookup/using31.C is correct, I am not sure.
>
>> Perhaps the checking code in handle_using_decl is also unnecessary.
>
> Definitely.
>
> Regtested x86_64-unknown-linux-gnu without regressions on an old tree.
> Regtesting in progress on a fresh tree.
> OK to commit if it succeeds ?
>
> gcc/ChangeLog
>
> 2010-11-15 ?Fabien Chêne ?<fabien@gcc.gnu.org>
>
> ? ? ? ?PR c++/26256
> ? ? ? ?* dbxout.c (dbxout_type_fields): Ignore using declarations.
>
>
> gcc/testsuite/ChangeLog
>
> 2010-11-15 ?Fabien Chêne ?<fabien@gcc.gnu.org>
>
> ? ? ? ?PR c++/26256
> ? ? ? ?* 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/debug/using4.C: New.
> ? ? ? ?* g++.dg/debug/using5.C: New.
> ? ? ? ?* g++.old-deja/g++.other/using1.C: Adjust.
> ? ? ? ?* g++.dg/template/using2.C: Likewise.
>
> gcc/cp/ChangeLog
>
> 2010-11-15 ?Fabien Chêne ?<fabien@gcc.gnu.org>
>
> ? ? ? ?PR c++/26256
> ? ? ? ?* 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.
> ? ? ? ?* 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.
> ? ? ? ?* parser.c (cp_parser_nonclass_name): Handle USING_DECLs.
> ? ? ? ?* name-lookup.c (supplement_binding): Extend the `struct stat'
> ? ? ? ?hack to handle using declarations.
> ? ? ? ?(push_class_level_binding): Returns early for dependent USING_DECLs
> ? ? ? ?and for USING_DECLs that refers to FUNCTION_DECL.
>
> --
> Fabien
>



-- 
Fabien

Attachment: pr26256.patch
Description: Binary data


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