Re: [PATCH] Fix PR c++/60573

2014-03-28 Thread Jason Merrill
OK. Jason

[PATCH] Fix PR c++/60573

2014-03-28 Thread Adam Butcher
PR c++/60573 * name-lookup.h (cp_binding_level): New transient field defining_class_p to indicate whether a scope is in the process of defining a class. * semantics.c (begin_class_definition): Set defining_class_p. * name-lookup.c (leave_scope): Reset definin

Re: [PATCH] Fix PR c++/60573

2014-03-28 Thread Adam Butcher
On 2014-03-27 21:16, Adam Butcher wrote: On 2014-03-27 20:45, Adam Butcher wrote: PR c++/60573 * name-lookup.h (cp_binding_level): New field scope_defines_class_p. * semantics.c (begin_class_definition): Set scope_defines_class_p. * pt.c (instantiate_class_template_1): Likewise. * parser.c (synt

Re: [PATCH] Fix PR c++/60573

2014-03-27 Thread Adam Butcher
On 2014-03-27 20:45, Adam Butcher wrote: PR c++/60573 * name-lookup.h (cp_binding_level): New field scope_defines_class_p. * semantics.c (begin_class_definition): Set scope_defines_class_p. * pt.c (instantiate_class_template_1): Likewise. * parser.c (synthesize_implicit_t

Re: [PATCH] Fix PR c++/60573

2014-03-27 Thread Adam Butcher
On 2014-03-27 20:45, Adam Butcher wrote: @@ -8905,9 +8905,12 @@ instantiate_class_template_1 (tree type) return type; /* Now we're really doing the instantiation. Mark the type as in - the process of being defined. */ + the process of being defined... */ TYPE_BEING_DEFINED

[PATCH] Fix PR c++/60573

2014-03-27 Thread Adam Butcher
PR c++/60573 * name-lookup.h (cp_binding_level): New field scope_defines_class_p. * semantics.c (begin_class_definition): Set scope_defines_class_p. * pt.c (instantiate_class_template_1): Likewise. * parser.c (synthesize_implicit_template_parm): Use cp_bindin

Re: [PATCH] Fix PR c++/60573

2014-03-27 Thread Jason Merrill
On 03/26/2014 09:12 PM, Adam Butcher wrote: +Note: cp_binding_level::class_shadowed is used as a predicate to +indicate whether a class scope is a class-defining scope. We stop +at the first such scope as this will be the currently open class +defi

[PATCH] Fix PR c++/60573

2014-03-26 Thread Adam Butcher
PR c++/60573 * parser.c (synthesize_implicit_template_parm): Use cp_binding_level:: class_shadowed rather than TYPE_BEING_DEFINED as the predicate for unwinding to class-defining scope to handle the erroneous definition of a generic function of an arbitrarily

Re: [PATCH] Fix PR c++/60573

2014-03-26 Thread Adam Butcher
On 2014-03-25 15:48, Jason Merrill wrote: I think we need some way to designate a scope that actually corresponds to a class-specifier. Agreed. I'll look into it. Adam

Re: [PATCH] Fix PR c++/60573

2014-03-26 Thread Adam Butcher
On 2014-03-26 15:17, Jason Merrill wrote: I meant struct A { struct X { struct B { void foo(auto); }; void B::foo(auto) {} // { dg-error "cannot define" } }; }; Here we push both A and X for the declarator. When we get to the pushed X, we se

Re: [PATCH] Fix PR c++/60573

2014-03-26 Thread Jason Merrill
On 03/25/2014 03:48 PM, Adam Butcher wrote: I don't follow. Are you suggesting a case like the following? struct A { struct X { struct B { void foo(auto); }; }; void X::B::foo(auto) {} // { dg-error "cannot define" } }; I meant s

Re: [PATCH] Fix PR c++/60573

2014-03-25 Thread Adam Butcher
On 2014-03-25 15:48, Jason Merrill wrote: On 03/18/2014 10:46 PM, Adam Butcher wrote: + if (TYPE_BEING_DEFINED (scope->this_entity)) + if (scope->level_chain == 0 + || scope->this_entity != scope->level_chain->this_entity) + break; I

Re: [PATCH] Fix PR c++/60573

2014-03-25 Thread Jason Merrill
On 03/18/2014 10:46 PM, Adam Butcher wrote: + if (TYPE_BEING_DEFINED (scope->this_entity)) + if (scope->level_chain == 0 + || scope->this_entity != scope->level_chain->this_entity) + break; I don't think this is an adequate test; if yo

Re: [PATCH] Fix PR c++/60573

2014-03-24 Thread Adam Butcher
On 2014-03-24 17:23, Jason Merrill wrote: On 03/18/2014 10:46 PM, Adam Butcher wrote: - while (scope->kind == sk_class -&& !TYPE_BEING_DEFINED (scope->this_entity)) Does it work to just change TYPE_BEING_DEFINED to currently_open_class? No. The object referred to by

Re: [PATCH] Fix PR c++/60573

2014-03-24 Thread Jason Merrill
On 03/18/2014 10:46 PM, Adam Butcher wrote: - while (scope->kind == sk_class -&& !TYPE_BEING_DEFINED (scope->this_entity)) Does it work to just change TYPE_BEING_DEFINED to currently_open_class? Jason

[PATCH] Fix PR c++/60573

2014-03-18 Thread Adam Butcher
PR c++/60573 * parser.c (synthesize_implicit_template_parm): Handle the fact that nested class member declarations erroneously appearing in an enclosing class contain an addition scope level for the class being defined. PR c++/60573 * g++.dg/cpp1y/pr