Improve error when trying to use an extern const as a compile time constant. #2969

This commit is contained in:
Christoffer Lerno
2026-02-23 19:15:23 +01:00
parent 8373ab0509
commit 0ed917cdc2
4 changed files with 42 additions and 3 deletions

View File

@@ -0,0 +1,16 @@
module test;
import std;
extern const void* FOO @cname("malloc");
macro foo($x) {}
fn void test()
{
var $x = FOO; // #error: $x must be assigned a compile-time constant. 'extern' constants are resolved
}
fn void test2()
{
foo(FOO); // #error: $x must be assigned a compile-time constant. 'extern' constants are resolved
}