2010/7/30 Fabien Chêne : > Hi Jason, Hi All, > > 2010/6/18 Jason Merrill : >> On 06/16/2010 04:30 PM, Fabien Chêne wrote: >>> >>> @@ -2703,6 +2703,8 @@ count_fields (tree fields) >>>   int n_fields = 0; >>>   for (x = fields; x; x = TREE_CHAIN (x)) >>>     { >>> +      if (TREE_CODE (x) == USING_DECL) >>> +       continue; >>> @@ -2720,6 +2722,9 @@ add_fields_to_record_type (tree fields, >>>   tree x; >>>   for (x = fields; x; x = TREE_CHAIN (x)) >>>     { >>> +      if (TREE_CODE (x) == USING_DECL) >>> +       continue; >> >> I don't think we want to skip USING_DECLs here; we aren't only counting >> FIELD_DECLs, we count TYPE_DECLs and CONST_DECLs, too. > > I will try to change that, but for now, it ICEs if we do not skip USING_DECLs. > > I'm close to the result, but I'm not sure about how should behave the > compiler with the following examples. > I think that in both cases, the using declaration is invalid, can you > confirm that ? I've treated all of them as invalid. Here is an updated patch. The fight against the testsuite makes me go a little bit beyond the scope of PR 26256. Tested x86_64-unknown-linux-gnu with no regressions. Is it ok for trunk ? gcc/ChangeLog 2010-08-18 Fabien Chêne PR c++/26256 * dbxout.c (dbxout_type_fields): Ignore using declarations. gcc/testsuite/ChangeLog 2010-08-18 Fabien Chêne 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/debug/using4.C: New. * g++.dg/debug/using5.C: New. * g++.old-deja/g++.other/using1.C: Adjust. * g++.old-deja/g++.other/using8.C: Likewise. * g++.dg/template/using2.C: Likewise. gcc/cp/ChangeLog 2010-08-18 Fabien Chêne 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): Store USING_DECLs with TYPE_DECLs. * typeck.c (build_class_member_access_expr): Handle USING_DECLs. * class.c (check_field_decls): Keep using declarations and diagnose conflicting declarations involving USING_DECLs. Call diagnose_conflicting_using_decls. (diagnose_conflicting_using_decls): New function. (handle_using_decl): Tweak to make things work for g++.old-deja/g++.other/using8.C. -- Fabien