Skip to content

Commit 3272f6f

Browse files
committed
Fix location report for missing closing parenthesis
1 parent 36dc794 commit 3272f6f

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

simplecpp.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1781,8 +1781,10 @@ namespace simplecpp {
17811781
expandValue.push_back(new Token(*tok));
17821782
tok = tok->next;
17831783
}
1784-
if (par != 0)
1785-
throw Error(endToken->location, "Missing closing parenthesis for __VA_OPT__");
1784+
if (par != 0) {
1785+
const Token *const lastTok = expandValue.back() ? expandValue.back() : valueToken->next;
1786+
throw Error(lastTok->location, "Missing closing parenthesis for __VA_OPT__");
1787+
}
17861788
} else {
17871789
expandValue.push_back(new Token(*tok));
17881790
noExpandValue.push_back(new Token(*tok));

0 commit comments

Comments
 (0)