From 391ed63747ad3b46816d3bd03c01c72269ea8266 Mon Sep 17 00:00:00 2001 From: Andrew Chambers Date: Thu, 27 Aug 2015 22:55:00 +1200 Subject: [PATCH] Fix nested parens in declarators. See diff of test/decl.c for details. --- parse.c | 1 + test/decl.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/parse.c b/parse.c index d30b5f99..8a3846bb 100644 --- a/parse.c +++ b/parse.c @@ -1960,6 +1960,7 @@ static Type *read_declarator(char **rname, Type *basety, Vector *params, int ctx // Here, we pass a dummy object to get "pointer to " first, // continue reading to get "function returning int", and then combine them. Type *stub = make_stub_type(); + *stub = *basety; Type *t = read_declarator(rname, stub, params, ctx); expect(')'); *stub = *read_declarator_tail(basety, params); diff --git a/test/decl.c b/test/decl.c index 71353699..7e6d0ecf 100644 --- a/test/decl.c +++ b/test/decl.c @@ -4,7 +4,8 @@ static void t1() { int a = 1; - expect(3, a + 2); + int ((b)) = 2; + expect(5, a + b + 2); } static void t2() {