$is_const is deprecated in favour of @is_const based on $defined.

`$foo` variables could be assigned non-compile time values.
`$foo[0] = ...` was incorrectly requiring that the assigned values were compile time constants.
This commit is contained in:
Christoffer Lerno
2025-07-10 18:31:38 +02:00
parent 70159c00cc
commit 988549599d
5 changed files with 50 additions and 16 deletions

View File

@@ -0,0 +1,20 @@
fn void test1()
{
int a;
var $x;
$x = a; // #error: only assign constants to a compile time
}
fn void test2()
{
int a;
int[2] $x = { 1, 2 };
$x[0] = a; // #error: argument must be a constant value
}
int g;
fn void test3()
{
int*[2] $x = { &g + 1, null };
int* $y = &g + 1;
$x[0] = &g + 1;
}