2011/3/5 Jason Merrill <ja...@redhat.com>: > On 03/04/2011 03:11 AM, Fabien Chêne wrote: >> >> Hmm, I've implemented what you were suggesting, and I don't understand >> the following check in supplement_binding: >> >> else if (TREE_CODE (bval) == TYPE_DECL&& DECL_ARTIFICIAL (bval)) >> { >> /* The old binding was a type name. It was placed in >> VALUE field because it was thought, at the point it was >> declared, to be the only entity with such a name. Move the >> type name into the type slot; it is now hidden by the new >> binding. */ >> binding->type = bval; >> binding->value = decl; >> binding->value_is_inherited = false; >> } >> >> Why is it usefull ? It prevents the following illegal code from being >> rejected: >> >> struct A >> { >> struct type {}; >> typedef int type; >> }; > > That's a bug. I guess the check above needs to make sure that decl is not a > TYPE_DECL.
OK, FYI I have opened PR c++/48010 for this bug, which I am going to fix first. -- Fabien