From 6731ea31e05b733e558c3daeb6817e7b2737e803 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Tue, 16 Dec 2008 19:00:20 +0000 Subject: [PATCH] Restore error check lost in r23661: The type of a function definition must not be a typedef. [r24729] --- parser.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/parser.c b/parser.c index a197607..fdc92cd 100644 --- a/parser.c +++ b/parser.c @@ -6346,7 +6346,8 @@ static void parse_external_declaration(void) } assert(is_declaration(ndeclaration)); - type_t *type = skip_typeref(ndeclaration->declaration.type); + type_t *const orig_type = ndeclaration->declaration.type; + type_t * type = skip_typeref(orig_type); if (!is_type_function(type)) { if (is_type_valid(type)) { @@ -6355,6 +6356,11 @@ static void parse_external_declaration(void) } eat_block(); return; + } else if (is_typeref(orig_type)) { + /* §6.9.1:2 */ + errorf(&ndeclaration->base.source_position, + "type of function definition '%#T' is a typedef", + orig_type, ndeclaration->base.symbol); } if (warning.aggregate_return && -- 2.20.1