Commit a6567a0f by Mark Mitchell Committed by Mark Mitchell

re PR c++/14186 (enum in base class conflicts with derived class)

	PR c++/14186
	* name-lookup.c (push_class_level_binding): Do not complain about
	adding a binding for a member whose name is the same as the
	enclosing class if the member is located in a base class of the
	current class.

	PR c++/14186
	* g++.dg/lookup/member1.C: New test.

From-SVN: r78149
parent f819a6a5
2004-02-19 Mark Mitchell <mark@codesourcery.com>
PR c++/14186
* name-lookup.c (push_class_level_binding): Do not complain about
adding a binding for a member whose name is the same as the
enclosing class if the member is located in a base class of the
current class.
2004-02-19 Giovanni Bajo <giovannibajo@gcc.gnu.org>
PR c++/14181
......
......@@ -2762,10 +2762,14 @@ push_class_level_binding (tree name, tree x)
&& DECL_CONTEXT (x) != current_class_type))
&& DECL_NAME (x) == constructor_name (current_class_type))
{
tree scope = context_for_name_lookup (x);
if (TYPE_P (scope) && same_type_p (scope, current_class_type))
{
error ("`%D' has the same name as the class in which it is declared",
x);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, false);
}
}
/* If this declaration shadows a declaration from an enclosing
class, then we will need to restore IDENTIFIER_CLASS_VALUE when
......
2004-02-19 Mark Mitchell <mark@codesourcery.com>
PR c++/14186
* g++.dg/lookup/member1.C: New test.
2004-02-19 Kazu Hirata <kazu@cs.umass.edu>
* gcc.c-torture/compile/20040130-1.c: Enable only when
......
// PR c++/14186
struct Base
{
enum { Derived };
};
class Derived : public Base
{
Derived();
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment