mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-13 06:28:52 +03:00
28 lines
409 B
D
28 lines
409 B
D
|
|
// RUN: %ldc -enable-dynamic-compile -run %s
|
|
|
|
import std.exception;
|
|
import ldc.attributes;
|
|
import ldc.dynamic_compile;
|
|
|
|
__gshared int[555] arr1 = 42;
|
|
__gshared int[555] arr2 = 42;
|
|
|
|
@dynamicCompile int foo()
|
|
{
|
|
int[555] a = arr1;
|
|
return a[3];
|
|
}
|
|
|
|
@dynamicCompile int bar()
|
|
{
|
|
arr2 = 0;
|
|
return arr2[3];
|
|
}
|
|
|
|
void main(string[] args)
|
|
{
|
|
compileDynamicCode();
|
|
assert(42 == foo());
|
|
assert(0 == bar());
|
|
}
|