mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Correctly error on @attrdef Foo = ;.
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
- Fix No index OOB check for `[:^n]` #2123.
|
||||
- Fix regression in Time diff due to operator overloading #2124.
|
||||
- attrdef with any invalid name causes compiler assert #2128.
|
||||
- Correctly error on `@attrdef Foo = ;`.
|
||||
|
||||
### Stdlib changes
|
||||
- Added `String.quick_ztr` and `String.is_zstr`
|
||||
|
||||
@@ -2229,6 +2229,12 @@ static inline Decl *parse_attrdef(ParseContext *c)
|
||||
if (try_consume(c, TOKEN_EOS)) return decl;
|
||||
|
||||
CONSUME_OR_RET(TOKEN_EQ, poisoned_decl);
|
||||
if (tok_is(c, TOKEN_EOS))
|
||||
{
|
||||
PRINT_ERROR_LAST("Expected a list of attributes after '='.");
|
||||
return poisoned_decl;
|
||||
}
|
||||
|
||||
bool is_cond;
|
||||
bool is_builtin = false;
|
||||
if (!parse_attribute_list(c, &attributes, NULL, decl_needs_prefix(decl) ? &is_builtin : NULL, &is_cond, true)) return poisoned_decl;
|
||||
|
||||
6
test/test_suite/attributes/attrdef_err.c3
Normal file
6
test/test_suite/attributes/attrdef_err.c3
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
attrdef @Foo = ; // #error: Expected a list of attributes after
|
||||
fn void main()
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user