* name-lookup.c (ambiguous_decl): Adds check for hidden types.
(unqualified_namespace_lookup): Adds check for hidden types.
* g++.dg/lookup/hidden-class10.C: New test.
* g++.dg/lookup/hidden-class11.C: New test.
From-SVN: r124963
2007-05-22 Ollie Wild <aaw@google.com>
+ * name-lookup.c (ambiguous_decl): Adds check for hidden types.
+ (unqualified_namespace_lookup): Adds check for hidden types.
+
+2007-05-22 Ollie Wild <aaw@google.com>
+
* decl.c (duplicate_decls): Verify namespace names are unique.
2007-05-21 Mark Mitchell <mark@codesourcery.com>
}
/* ... and copy the type. */
type = new->type;
- if (LOOKUP_NAMESPACES_ONLY (flags))
+ if (LOOKUP_NAMESPACES_ONLY (flags) || (type && hidden_name_p (type)))
type = NULL_TREE;
if (!old->type)
old->type = type;
if (b->value
&& ((flags & LOOKUP_HIDDEN) || !hidden_name_p (b->value)))
binding.value = b->value;
- binding.type = b->type;
+ if (b->type
+ && ((flags & LOOKUP_HIDDEN) || !hidden_name_p (b->type)))
+ binding.type = b->type;
}
/* Add all _DECLs seen through local using-directives. */
2007-05-22 Ollie Wild <aaw@google.com>
+ * g++.dg/lookup/hidden-class10.C: New test.
+ * g++.dg/lookup/hidden-class11.C: New test.
+
+2007-05-22 Ollie Wild <aaw@google.com>
+
* g++.dg/lookup/name-clash5.C: New test.
* g++.dg/lookup/name-clash6.C: New test.
--- /dev/null
+// Copyright (C) 2007 Free Software Foundation
+// Contributed by Ollie Wild <aaw@google.com>
+// { dg-do compile }
+
+// Verify that a friend class is hidden even if it overrides a builtin
+// function name.
+
+class A {
+ friend class abort;
+ abort *b; // { dg-error "no type|expected" }
+};
--- /dev/null
+// Copyright (C) 2007 Free Software Foundation
+// Contributed by Ollie Wild <aaw@google.com>
+// { dg-do compile }
+
+// Verify that a friend class is hidden even if it is hidden by a non-builtin
+// function name.
+
+namespace M {
+ void F (void);
+ class F;
+}
+
+namespace N {
+ void F(void);
+ class A {
+ friend class F;
+ };
+}
+
+using namespace M;
+using namespace N;
+
+class F *b;