From 75982b38cd2b35a1ce9dd6f1899e8c3759f4b4a0 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Wed, 17 Dec 2008 10:44:48 +0000 Subject: [PATCH] Improve the AST a little: Overwrite the type of a function at the definition in case the previous declaration used a typedef. [r24747] --- parser.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/parser.c b/parser.c index 8f3e07f..ab66f35 100644 --- a/parser.c +++ b/parser.c @@ -5132,7 +5132,9 @@ static entity_t *record_entity(entity_t *entity, const bool is_definition) * declarations (except if the previous declaration is neither * none nor extern) */ if (entity->kind == ENTITY_FUNCTION) { - if (prev_type->function.unspecified_parameters) + /* the previous declaration could have unspecified parameters or + * be a typedef, so use the new type */ + if (prev_type->function.unspecified_parameters || is_definition) prev_decl->type = type; switch (old_storage_class) { -- 2.20.1