Improve the AST a little: Overwrite the type of a function at the definition in case...
authorChristoph Mallon <christoph.mallon@gmx.de>
Wed, 17 Dec 2008 10:44:48 +0000 (10:44 +0000)
committerChristoph Mallon <christoph.mallon@gmx.de>
Wed, 17 Dec 2008 10:44:48 +0000 (10:44 +0000)
[r24747]

parser.c

index 8f3e07f..ab66f35 100644 (file)
--- 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) {