From: Christoph Mallon Date: Wed, 17 Sep 2008 07:50:51 +0000 (+0000) Subject: The element type of an array shall not be an incomplete or function type. X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=28bfc385542be7206caadde3a68e0014fa8b9720;p=cparser The element type of an array shall not be an incomplete or function type. [r22028] --- diff --git a/parser.c b/parser.c index 1d4b640..b1f4a51 100644 --- a/parser.c +++ b/parser.c @@ -4160,6 +4160,7 @@ static type_t *construct_declarator_type(construct_type_t *construct_list, function_type->function.return_type = type; type_t *skipped_return_type = skip_typeref(type); + /* §6.7.5.3(1) */ if (is_type_function(skipped_return_type)) { errorf(HERE, "function returning function is not allowed"); } else if (is_type_array(skipped_return_type)) { @@ -4212,8 +4213,12 @@ static type_t *construct_declarator_type(construct_type_t *construct_list, } type_t *skipped_type = skip_typeref(type); - if (is_type_atomic(skipped_type, ATOMIC_TYPE_VOID)) - errorf(HERE, "array of void is not allowed"); + /* §6.7.5.2(1) */ + if (is_type_incomplete(skipped_type)) { + errorf(HERE, "array of incomplete type '%T' is not allowed", type); + } else if (is_type_function(skipped_type)) { + errorf(HERE, "array of functions is not allowed"); + } type = array_type; break; }