commit 815fbf1df6dafdbeb04a35827222d78c9b419219
Author: Jason Merrill <jason@redhat.com>
Date: Mon Jun 10 12:29:35 2013 -0400
* name-lookup.c (add_decl_to_level): Add decls in an anonymous
namespace to static_decls.
@@ -597,7 +597,9 @@ add_decl_to_level (tree decl, cp_binding_level *b)
if ((VAR_P (decl)
&& (TREE_STATIC (decl) || DECL_EXTERNAL (decl)))
|| (TREE_CODE (decl) == FUNCTION_DECL
- && (!TREE_PUBLIC (decl) || DECL_DECLARED_INLINE_P (decl))))
+ && (!TREE_PUBLIC (decl)
+ || decl_anon_ns_mem_p (decl)
+ || DECL_DECLARED_INLINE_P (decl))))
vec_safe_push (b->static_decls, decl);
}
}
new file mode 100644
@@ -0,0 +1,8 @@
+namespace {
+ void f(); // { dg-message "never defined" }
+}
+
+int main()
+{
+ f();
+}