mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Fix issue with labelled break inside of a $switch.
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
- Switch case with const non-int / enum would be treated as ints and crash. #2263
|
||||
- Missing bounds check on upper bound with const ranges `foo[1:3]`.
|
||||
- Check up the hierarchy when considering if an interface cast is valid #2267.
|
||||
- Fix issue with labelled break inside of a $switch.
|
||||
|
||||
### Stdlib changes
|
||||
|
||||
|
||||
@@ -2224,9 +2224,10 @@ static inline bool sema_analyse_then_overwrite(SemaContext *context, Ast *statem
|
||||
return true;
|
||||
}
|
||||
Ast *last = NULL;
|
||||
statement->ast_kind = AST_NOP_STMT;
|
||||
AstId next = statement->next;
|
||||
*statement = *astptr(replacement);
|
||||
AstId current = astid(statement);
|
||||
statement->next = replacement;
|
||||
AstId current = replacement;
|
||||
ASSERT(current);
|
||||
while (current)
|
||||
{
|
||||
|
||||
17
test/test_suite/compile_time/compile_time_with_break.c3t
Normal file
17
test/test_suite/compile_time/compile_time_with_break.c3t
Normal file
@@ -0,0 +1,17 @@
|
||||
enum Test
|
||||
{
|
||||
FOO,
|
||||
}
|
||||
|
||||
fn int main()
|
||||
{
|
||||
int v;
|
||||
$switch (Test.FOO):
|
||||
$case FOO:
|
||||
if START: (v < 5)
|
||||
{
|
||||
if (v > 3) break START;
|
||||
}
|
||||
$endswitch
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user