aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog8
-rw-r--r--gcc/cp/name-lookup.c10
2 files changed, 15 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index e0cd765..d1dea6d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,11 @@
+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
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index e1cc770..e823ae3 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -2762,9 +2762,13 @@ push_class_level_binding (tree name, tree x)
&& DECL_CONTEXT (x) != current_class_type))
&& DECL_NAME (x) == constructor_name (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);
+ 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