Hi! (Again, sorry for the long delay, but I indeed have very few time to work on it)
2011/6/22 Jason Merrill <ja...@redhat.com>: > On 06/15/2011 01:58 PM, Fabien Chęne wrote: >> >> Otherwise, perhaps that it would be better if the second declaration >> of E1 does not rely on supplement_binding_1. >> What do you think ? > > I agree. We should be using xref_tag for this like we do with classes, so > we don't try to push the same tag more than once. Ah, yes it works for the previous testcase, but I can't manage to make it work for the below example: template<typename T> struct S1 { enum E : T; // { dg-error "previous definition" } enum E : int; // { dg-error "different underlying type" } }; template struct S1<short>; // { dg-message "required from here" } I tried various things without success, and I ended up hacking supplement_binding_1 to handle those ENUMERAL_TYPEs. I am all ear for another solution ... Attached is an updated patch that should address most of your previous comments (except for c++0X enums). Tested x86_64_unknown-linux-gnu without new regressions. Is it in better shape ? gcc/ChangeLog 2011-09-15 Fabien Chêne <fab...@gcc.gnu.org> PR c++/26256 * dbxout.c (dbxout_type_fields): Ignore using declarations. gcc/testsuite/ChangeLog 2011-09-15 Fabien Chêne <fab...@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/lookup/using35.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-09-15 Fabien Chêne <fab...@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. * 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. Add a hack for handling ENUMERAL_TYPE. (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. -- Fabien
pr26256.patch
Description: Binary data