Re: [C++ Patch] for c++/23211
OK, thanks. Jason
Re: [C++ Patch] for c++/23211
2011/12/27 Jason Merrill : > On 12/27/2011 02:12 PM, Fabien Chêne wrote: >> >> - if (!scope_dependent_p) >> + if (!dependent_scope_p (scope)) > > I was thinking to change the line > >> scope_dependent_p = dependent_type_p (scope); > > to use dependent_scope_p instead of dependent_type_p. OK, I have adjusted the patch. It passes regtest as well (on x86_64_unknown-linux-gnu). gcc/testsuite/ChangeLog 2011-12-27 Fabien Chêne PR c++/23211 * g++.dg/template/using18.C: New. * g++.dg/template/using19.C: New. * g++.dg/template/nested3.C: Remove dg-message at instantiation. * g++.dg/template/crash13.C: Likewise. gcc/cp/ChangeLog 2011-12-27 Fabien Chêne PR c++/23211 * name-lookup.c (do_class_using_decl): Use dependent_scope_p instead of dependent_type_p, to check that a non-dependent nested-name-specifier of a class-scope using declaration refers to a base, even if the current scope is dependent. * parser.c (cp_parser_using_declaration): Set USING_DECL_TYPENAME_P to 1 if the DECL is not null. Re-indent a 'else' close to the prior modification. -- Fabien pr23211.patch Description: Binary data
Re: [C++ Patch] for c++/23211
On 12/27/2011 02:12 PM, Fabien Chêne wrote: - if (!scope_dependent_p) + if (!dependent_scope_p (scope)) I was thinking to change the line scope_dependent_p = dependent_type_p (scope); to use dependent_scope_p instead of dependent_type_p. Jason
Re: [C++ Patch] for c++/23211
2011/12/21 Jason Merrill : > This seems problematic to me; it could be that a dependent scope ends up > matching a non-dependent base in the end, i.e. > > struct A { int x; }; > > template > struct B: A > { > using T::x; > }; > > B b; Very nice indeed, I hadn't thought of that. > this code is silly, but I think well-formed, and that your patch will break > it. > > I think that just changing dependent_type_p (scope) to dependent_scope_p > (scope) will have the desired effect on this testcase. Yes, it works. Tested x86_64-unknown-linux-gnu, OK to commit ? gcc/testsuite/ChangeLog 2011-12-27 Fabien Chêne PR c++/23211 * g++.dg/template/using18.C: New. * g++.dg/template/using19.C: New. * g++.dg/template/nested3.C: Remove dg-message at instantiation. * g++.dg/template/crash13.C: Likewise. gcc/cp/ChangeLog 2011-12-27 Fabien Chêne PR c++/23211 * name-lookup.c (do_class_using_decl): Check that a non-dependent nested-name-specifier of a class-scope using declaration refers to a base, even if the current scope is dependent. * parser.c (cp_parser_using_declaration): Set USING_DECL_TYPENAME_P to 1 if the DECL is not null. Re-indent a 'else' close to the prior modification. -- Fabien 23211.patch Description: Binary data
Re: [C++ Patch] for c++/23211
This seems problematic to me; it could be that a dependent scope ends up matching a non-dependent base in the end, i.e. struct A { int x; }; template struct B: A { using T::x; }; B b; this code is silly, but I think well-formed, and that your patch will break it. I think that just changing dependent_type_p (scope) to dependent_scope_p (scope) will have the desired effect on this testcase. Jason
[C++ Patch] for c++/23211
Hi, As a follow up of c++/14258, this one is about undiagnosed using declarations whose nested-name-specifier is not a base. The diagnostic was only emitted at instantiation time, whereas it could be emitted before. I just removed a test to perform the verification before instantiation, it seems to work. Tested x86_64-unknown-linux-gnu, OK to commit ? gcc/testsuite/ChangeLog 2011-12-20 Fabien Chêne PR c++/23211 * g++.dg/template/using18.C: New. * g++.dg/template/nested3.C: Remove dg-message on the instantiation. * g++.dg/template/crash13.C: Likewise. gcc/cp/ChangeLog 2011-12-20 Fabien Chêne PR c++/23211 * name-lookup.c (do_class_using_decl): Check that the nested-name-specifier of a class-scope using declaration refers to a base class, even if the current scope is dependent. * parser.c (cp_parser_using_declaration): Set USING_DECL_TYPENAME_P to 1 if the DECL is not null. Re-indent a 'else' close to the prior modification. -- Fabien 23211.patch Description: Binary data