diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-04-10 03:00:19 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-04-10 03:00:19 -0400 |
| commit | 34eff503265834172f89a8635e49e9f4d124db51 (patch) | |
| tree | d18cc0735ffcbe09dabb9ec3a7f32a7bbc20b1a9 /test/cases/eval.zig | |
| parent | 0e77b0ac8936b0f09deb23733fe5a772869a64e6 (diff) | |
| download | zig-34eff503265834172f89a8635e49e9f4d124db51.tar.gz zig-34eff503265834172f89a8635e49e9f4d124db51.zip | |
fix for loops not working at compile-time
closes #315
Diffstat (limited to 'test/cases/eval.zig')
| -rw-r--r-- | test/cases/eval.zig | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/cases/eval.zig b/test/cases/eval.zig index 0d52985329..677feff48d 100644 --- a/test/cases/eval.zig +++ b/test/cases/eval.zig @@ -299,3 +299,18 @@ const Foo = struct { var foo_contents = Foo { .name = "a", }; const foo_ref = &foo_contents; + + + +test "create global array with for loop" { + assert(global_array[5] == 5 * 5); + assert(global_array[9] == 9 * 9); +} + +const global_array = { + var result: [10]usize = undefined; + for (result) |*item, index| { + *item = index * index; + } + result +}; |
