From 79cfed3bedf4f202d014e2e0808ee908f7930468 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Tue, 2 Dec 2008 22:29:52 +0000 Subject: [PATCH] =?utf8?q?Adhere=20=C2=A76.7.6:2=20footnote=20126:=20=20Em?= =?utf8?q?pty=20parentheses=20in=20a=20type=20name=20are=20interpreted=20a?= =?utf8?q?s=20``function=20with=20no=20parameter=20specification,=20rather?= =?utf8?q?=20than=20redundant=20parentheses=20around=20the=20omitted=20ide?= =?utf8?q?ntifier.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit [r24237] --- parser.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/parser.c b/parser.c index 1d4862c..1a5a776 100644 --- a/parser.c +++ b/parser.c @@ -4440,15 +4440,20 @@ ptr_operator_end: next_token(); break; case '(': - next_token(); - add_anchor_token(')'); - inner_types = parse_inner_declarator(env, may_be_abstract); - if (inner_types != NULL) { - /* All later declarators only modify the return type */ - env = NULL; + /* §6.7.6:2 footnote 126: Empty parentheses in a type name are + * interpreted as ``function with no parameter specification'', rather + * than redundant parentheses around the omitted identifier. */ + if (look_ahead(1)->type != ')') { + next_token(); + add_anchor_token(')'); + inner_types = parse_inner_declarator(env, may_be_abstract); + if (inner_types != NULL) { + /* All later declarators only modify the return type */ + env = NULL; + } + rem_anchor_token(')'); + expect(')'); } - rem_anchor_token(')'); - expect(')'); break; default: if (may_be_abstract) -- 2.20.1