Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix nested parens in declarators. #69

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <something>" 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);
Expand Down
3 changes: 2 additions & 1 deletion test/decl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down