Open xhook opened 4 months ago
No repo on windows.
zig-windows-x86_64-0.13.0-dev.266+0b0625ccf\zig run wat.zig
wat.zig:30:49: error: error union type '@typeInfo(@typeInfo(@TypeOf(wat.MLP(3,2,.{ 16, 16, 1 }).init)).Fn.return_type.?).ErrorUnion.error_set!wat.MLP(3,2,.{ 16, 16, 1 })' does not support field access
std.debug.print("mlp.layers.len {}\n", .{mlp.layers.len});
~~~^~~~~~~
wat.zig:30:49: note: consider using 'try', 'catch', or 'if'
referenced by:
callMain: zig-windows-x86_64-0.13.0-dev.266+0b0625ccf\lib\std\start.zig:524:32
WinStartup: zig-windows-x86_64-0.13.0-dev.266+0b0625ccf\lib\std\start.zig:363:45
remaining reference traces hidden; use '-freference-trace' to see all reference traces
wat.zig:20:44: error: unable to evaluate comptime expression
const layer_type = Layer(sz[i], sz[i + 1]);
~~^~~
wat.zig:20:45: note: operation is runtime due to this operand
const layer_type = Layer(sz[i], sz[i + 1]);
^
I was able to reproduce on Ubuntu 22.04 from 0b0625ccf4
:
as well as an older build from master branch commit 67455c5e70e86dbb7805ff9a415f1b13b14f36da
:
Zig Version
0.13.0-dev.266+0b0625ccf
Steps to Reproduce and Observed Behavior
I am learning Zig by experimenting with writing a simple neural network code and experience a compiler crash. I tried to distill the code to the very minimum, that causes the crash. This code is not entirely correct, and being frank, I don't even know if it should compile at all. But certainly it should not crash.
By running the above code I get the following error:
Tried also running it on v0.12.0 as well as 0.12.x branch. The result is the same.
Expected Behavior
The compiler should give a compilation error or compile the code.