aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2000-12-15 11:15:52 -0500
committerJason Merrill <jason@gcc.gnu.org>2000-12-15 11:15:52 -0500
commitfab09a2494224143e42b78a8b4af1c318cc188cb (patch)
treea93c275abcfc9a60e8703ae251ac53109640e4b7 /gcc
parent1e185c02d4e262b785467eee4de814e1b27118d6 (diff)
downloadgcc-fab09a2494224143e42b78a8b4af1c318cc188cb.zip
gcc-fab09a2494224143e42b78a8b4af1c318cc188cb.tar.gz
gcc-fab09a2494224143e42b78a8b4af1c318cc188cb.tar.bz2
* decl.c (pushdecl): Don't check for linkage on a non-decl.
From-SVN: r38290
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog2
-rw-r--r--gcc/cp/decl.c5
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/local4.C10
3 files changed, 15 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a13baaa..3143094 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 4d1867d..924447f 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -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
index 0000000..fd8f512
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.other/local4.C
@@ -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 ();
+}