Improve error message when using ',' in struct declarations. #1920

This commit is contained in:
Christoffer Lerno
2025-02-02 22:44:22 +01:00
parent 50c590bb5f
commit f2df4855ff
3 changed files with 12 additions and 0 deletions

View File

@@ -1629,6 +1629,10 @@ static bool parse_struct_body(ParseContext *c, Decl *parent)
{
RETURN_PRINT_ERROR_AT(false, member, "'inline' can only be applied to a single member, so please define it on its own line.");
}
if (token_is_any_type(c->tok))
{
RETURN_PRINT_ERROR_LAST("Did you accidentally use ',' rather than ';' between your declarations?");
}
}
Decl **members = parent->strukt.members;
unsigned last_index = vec_size(members) - 1;