mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 03:51:18 +00:00
Improve error when trying to use an extern const as a compile time constant. #2969
This commit is contained in:
16
test/test_suite/compile_time/extern_is_not_const.c3
Normal file
16
test/test_suite/compile_time/extern_is_not_const.c3
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user