Open danielsan901998 opened 8 months ago
Same applies to switch cases:
const image_count = std.math.clamp(
switch (actual_present_mode) {
vk.PRESENT_MODE_IMMEDIATE, vk.PRESENT_MODE_FIFO => 2,
vk.PRESENT_MODE_MAILBOX => 3,
else => unreachable,
},
1,
4
);
// ignore that the clamping doesn't make sense here anymore
Error:
error: value with comptime-only type 'comptime_int' depends on runtime control flow
switch (actual_present_mode) {
^~~~~~
src/backend/vulkan.zig:1047:21: note: runtime control flow here
switch (actual_present_mode) {
^~~~~~~~~~~~~~~~~~~
Zig Version
0.12.0-dev.2271+14efbbfd8
Steps to Reproduce and Observed Behavior
Using translate-c with this c function:
Generate this error when compiling a test that call the function:
Expected Behavior
Successful compilation since when using the result of sizeof it does generate
@as(c_int, 21)
and it does compile successfully.