OSDN Git Service

* decl.c (pushdecl): Don't check for linkage on a non-decl.
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 15 Dec 2000 16:15:52 +0000 (16:15 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 15 Dec 2000 16:15:52 +0000 (16:15 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@38290 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/g++.old-deja/g++.other/local4.C [new file with mode: 0644]

index a13baaa..3143094 100644 (file)
@@ -1,5 +1,7 @@
 2000-12-15  Jason Merrill  <jason@redhat.com>
 
+       * decl.c (pushdecl): Don't check for linkage on a non-decl.
+
        * call.c (build_op_delete_call): See through ARRAY_TYPEs.
 
        * call.c (build_new_function_call): Lose space before paren in
index 4d1867d..924447f 100644 (file)
@@ -3821,8 +3821,9 @@ pushdecl (x)
          /* Or in the innermost namespace.  */
          if (! t)
            t = namespace_binding (name, DECL_CONTEXT (x));
-         /* Does it have linkage?  */
-         if (t && ! (TREE_STATIC (t) || DECL_EXTERNAL (t)))
+         /* Does it have linkage?  Note that if this isn't a DECL, it's an
+            OVERLOAD, which is OK.  */
+         if (t && DECL_P (t) && ! (TREE_STATIC (t) || DECL_EXTERNAL (t)))
            t = NULL_TREE;
          if (t)
            different_binding_level = 1;
diff --git a/gcc/testsuite/g++.old-deja/g++.other/local4.C b/gcc/testsuite/g++.old-deja/g++.other/local4.C
new file mode 100644 (file)
index 0000000..fd8f512
--- /dev/null
@@ -0,0 +1,10 @@
+// Test that a local declaration of one of a global overload set works
+
+int f () { return 0; }
+int f (int);
+
+int main ()
+{
+  int f ();
+  return f ();
+}