mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
$for ct-state not properly popped.
This commit is contained in:
@@ -19,6 +19,7 @@
|
|||||||
- Check up the hierarchy when considering if an interface cast is valid #2267.
|
- Check up the hierarchy when considering if an interface cast is valid #2267.
|
||||||
- Fix issue with labelled break inside of a $switch.
|
- Fix issue with labelled break inside of a $switch.
|
||||||
- Non-const macros may not return untyped lists.
|
- Non-const macros may not return untyped lists.
|
||||||
|
- `$for` ct-state not properly popped.
|
||||||
|
|
||||||
### Stdlib changes
|
### Stdlib changes
|
||||||
|
|
||||||
|
|||||||
@@ -3048,6 +3048,7 @@ static inline bool sema_analyse_ct_for_stmt(SemaContext *context, Ast *statement
|
|||||||
// Analysis is done turn the generated statements into a compound statement for lowering.
|
// Analysis is done turn the generated statements into a compound statement for lowering.
|
||||||
statement->ast_kind = AST_CT_COMPOUND_STMT;
|
statement->ast_kind = AST_CT_COMPOUND_STMT;
|
||||||
statement->ct_compound_stmt = start;
|
statement->ct_compound_stmt = start;
|
||||||
|
sema_context_pop_ct_stack(context, for_context);
|
||||||
return true;
|
return true;
|
||||||
FAILED:
|
FAILED:
|
||||||
sema_context_pop_ct_stack(context, for_context);
|
sema_context_pop_ct_stack(context, for_context);
|
||||||
|
|||||||
16
test/test_suite/compile_time/pop_ct_for.c3
Normal file
16
test/test_suite/compile_time/pop_ct_for.c3
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
fn int main()
|
||||||
|
{
|
||||||
|
$for var $i = 1; $i < 8; ++$i :
|
||||||
|
$endfor
|
||||||
|
|
||||||
|
$for var $i = 0; $i < 8; ++$i :
|
||||||
|
$endfor
|
||||||
|
|
||||||
|
const int[*] ABC = { 1, 2, 3 };
|
||||||
|
$foreach $i, $val : ABC:
|
||||||
|
$endforeach
|
||||||
|
$foreach $i, $val : ABC:
|
||||||
|
$endforeach
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user