summaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2006-08-25 21:11:46 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2006-08-25 21:11:46 +0000
commit4d5ac30e9f47263ee5925a85e0a4e6c531a4981e (patch)
treec5d660b0cc2b1511757821e913c937802626245b /gcc/c-decl.c
parent376d06105c079e7bcbfea0b440f938f7fe76546a (diff)
downloadgcc-4d5ac30e9f47263ee5925a85e0a4e6c531a4981e.tar.gz
PR c/28299
* c-decl.c (start_function): Don't try to process prototype information from old declaration that isn't a function. testsuite: * gcc.dg/funcdef-var-1.c, gcc.dg/funcdef-var-2.c: New tests. * gcc.dg/pr20368-1.c, gcc.dg/pr20368-2.c, gcc.dg/pr20368-3.c: Expect extra diagnostics. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116435 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 494c221f555..cf89191ae2e 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -5991,6 +5991,8 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator,
/* If this definition isn't a prototype and we had a prototype declaration
before, copy the arg type info from that prototype. */
old_decl = lookup_name_in_scope (DECL_NAME (decl1), current_scope);
+ if (old_decl && TREE_CODE (old_decl) != FUNCTION_DECL)
+ old_decl = 0;
current_function_prototype_locus = UNKNOWN_LOCATION;
current_function_prototype_built_in = false;
current_function_prototype_arg_types = NULL_TREE;