mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Fix bug when multiple $else clauses followed an $if #1824.
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
- Handle bytes and string literals the same way in terms of zero termination.
|
||||
- Function comments are stored and displayed with -P.
|
||||
- Prevent `#hash` arguments from taking code that modifies ct variables. #1794
|
||||
|
||||
### Fixes
|
||||
- Fix case trying to initialize a `char[*]*` from a String.
|
||||
- Fix Map & HashMap `put_all_for_create` not copying all elements, causing `init_from_map` to create incomplete copy.
|
||||
@@ -79,6 +80,7 @@
|
||||
- Assert when partially initializing a constant struct containing a slice #1812.
|
||||
- Assert concatenating constant slices #1805.
|
||||
- Do not link "ld" on Linux with no libc.
|
||||
- Fix bug when multiple `$else` clauses followed an `$if` #1824.
|
||||
|
||||
### Stdlib changes
|
||||
- Increase BitWriter.write_bits limit up to 32 bits.
|
||||
|
||||
@@ -1040,7 +1040,7 @@ static inline Ast *parse_ct_if_stmt(ParseContext *c)
|
||||
if (!parse_ct_compound_stmt(c, &else_ast->ct_else_stmt)) return poisoned_ast;
|
||||
ast->ct_if_stmt.elif = astid(else_ast);
|
||||
}
|
||||
advance_and_verify(c, TOKEN_CT_ENDIF);
|
||||
CONSUME_OR_RET(TOKEN_CT_ENDIF, poisoned_ast);
|
||||
RANGE_EXTEND_PREV(ast);
|
||||
return ast;
|
||||
}
|
||||
|
||||
8
test/test_suite/compile_time/ct_else_else.c3
Normal file
8
test/test_suite/compile_time/ct_else_else.c3
Normal file
@@ -0,0 +1,8 @@
|
||||
// Issue #1824
|
||||
fn void main()
|
||||
{
|
||||
$if true:
|
||||
$else
|
||||
$else // #error: Expected '$endif'
|
||||
$endif
|
||||
}
|
||||
Reference in New Issue
Block a user