(pop_nested_namespace): Sanity check.
* cp-tree.h: Declare current_decl_namespace.
* decl.c (grokvardecl): Use it instead of current_namespace.
(grokfndecl): Likewise.
* gnu/gcj/runtime/natSharedLibLoader.cc (findCore): Move
declaration of _Jv_create_core out of the function.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158074
138bc75d-0d04-0410-961f-
82ee72b054a4
2010-04-07 Jason Merrill <jason@redhat.com>
2010-04-07 Jason Merrill <jason@redhat.com>
+ * name-lookup.c (current_decl_namespace): Non-static.
+ (pop_nested_namespace): Sanity check.
+ * cp-tree.h: Declare current_decl_namespace.
+ * decl.c (grokvardecl): Use it instead of current_namespace.
+ (grokfndecl): Likewise.
+
PR c++/38392
* pt.c (tsubst_friend_function): Instatiate a friend that has already
been used.
PR c++/38392
* pt.c (tsubst_friend_function): Instatiate a friend that has already
been used.
extern tree check_for_out_of_scope_variable (tree);
extern void print_other_binding_stack (struct cp_binding_level *);
extern tree maybe_push_decl (tree);
extern tree check_for_out_of_scope_variable (tree);
extern void print_other_binding_stack (struct cp_binding_level *);
extern tree maybe_push_decl (tree);
+extern tree current_decl_namespace (void);
/* decl.c */
extern tree poplevel (int, int, int);
/* decl.c */
extern tree poplevel (int, int, int);
if (in_namespace)
set_decl_namespace (decl, in_namespace, friendp);
else if (!ctype)
if (in_namespace)
set_decl_namespace (decl, in_namespace, friendp);
else if (!ctype)
- DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace);
+ DECL_CONTEXT (decl) = FROB_CONTEXT (current_decl_namespace ());
/* `main' and builtins have implicit 'C' linkage. */
if ((MAIN_NAME_P (declarator)
/* `main' and builtins have implicit 'C' linkage. */
if ((MAIN_NAME_P (declarator)
/* An explicit "extern" specifier indicates a namespace-scope
variable. */
if (declspecs->storage_class == sc_extern)
/* An explicit "extern" specifier indicates a namespace-scope
variable. */
if (declspecs->storage_class == sc_extern)
- scope = current_namespace;
+ scope = current_decl_namespace ();
else if (!at_function_scope_p ())
scope = current_scope ();
}
else if (!at_function_scope_p ())
scope = current_scope ();
}
/* Return the namespace where the current declaration is declared. */
/* Return the namespace where the current declaration is declared. */
current_decl_namespace (void)
{
tree result;
current_decl_namespace (void)
{
tree result;
pop_nested_namespace (tree ns)
{
timevar_push (TV_NAME_LOOKUP);
pop_nested_namespace (tree ns)
{
timevar_push (TV_NAME_LOOKUP);
+ gcc_assert (current_namespace == ns);
while (ns != global_namespace)
{
pop_namespace ();
while (ns != global_namespace)
{
pop_namespace ();
2010-04-07 Jason Merrill <jason@redhat.com>
2010-04-07 Jason Merrill <jason@redhat.com>
+ * g++.dg/lookup/ns4.C: New.
+
PR c++/38392
* g++.dg/template/friend51.C: New test.
PR c++/38392
* g++.dg/template/friend51.C: New test.
--- /dev/null
+// { dg-do link }
+
+namespace N {
+ void f();
+}
+
+void N::f()
+{
+ extern int i;
+ extern void g();
+ i = 1;
+ g();
+}
+
+namespace N {
+ int i;
+ void g() { }
+}
+
+int main() { }
+2010-04-07 Jason Merrill <jason@redhat.com>
+
+ * gnu/gcj/runtime/natSharedLibLoader.cc (findCore): Move
+ declaration of _Jv_create_core out of the function.
+
2010-04-02 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* Makefile.in: Regenerate.
2010-04-02 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* Makefile.in: Regenerate.
+#ifdef HAVE_DLOPEN
+extern gnu::gcj::Core *_Jv_create_core (_Jv_core_chain *node, jstring name);
+#endif
+
gnu::gcj::Core *
gnu::gcj::runtime::SharedLibHelper::findCore (jstring name)
{
#ifdef HAVE_DLOPEN
gnu::gcj::Core *
gnu::gcj::runtime::SharedLibHelper::findCore (jstring name)
{
#ifdef HAVE_DLOPEN
- extern gnu::gcj::Core *_Jv_create_core (_Jv_core_chain *node, jstring name);
ensureInit();
return _Jv_create_core ((_Jv_core_chain *) core_chain, name);
#else
ensureInit();
return _Jv_create_core ((_Jv_core_chain *) core_chain, name);
#else