From a9c2e59f609a1d717e999df1ba83a0b5dd725df1 Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Sat, 4 Dec 2021 01:08:16 +0100 Subject: [PATCH] Fix incorrect check in macro arguments. --- src/compiler/parse_global.c | 2 +- test/test_suite/regression/crash_on_right_paren_macro.c3 | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 test/test_suite/regression/crash_on_right_paren_macro.c3 diff --git a/src/compiler/parse_global.c b/src/compiler/parse_global.c index 72217f0cd..39750a96c 100644 --- a/src/compiler/parse_global.c +++ b/src/compiler/parse_global.c @@ -1466,7 +1466,7 @@ static bool parse_macro_arguments(Context *context, Visibility visibility, Decl } // TODO use the body param. } - TRY_CONSUME(TOKEN_RPAREN, false); + CONSUME_OR(TOKEN_RPAREN, false); return true; } diff --git a/test/test_suite/regression/crash_on_right_paren_macro.c3 b/test/test_suite/regression/crash_on_right_paren_macro.c3 new file mode 100644 index 000000000..9605bf231 --- /dev/null +++ b/test/test_suite/regression/crash_on_right_paren_macro.c3 @@ -0,0 +1,6 @@ +macro void hello($b$Bar x; // #error: Expected ')' + @hello(1); + var $foo = 1; + $foo; + FOO; +}