Skip to content

Commit

Permalink
procure test for ziglang#8640
Browse files Browse the repository at this point in the history
  • Loading branch information
RetroDev256 committed Nov 24, 2024
1 parent 0862fba commit f2c79ec
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/cases/comparing_switch_results_across_inferred_anytype.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
pub fn main() !void {
const x: u32 = 1;
var y: u32 = undefined;
y = x;

const a = switch (x) {
1 => 1,
else => 3,
};

const b = anytypeInner(.{switch (y) {
1 => "1",
else => "3",
}});

if (b[0] - '0' != a) return error.Miscompilation;
}

fn anytypeInner(thing: anytype) []const u8 {
return thing[0];
}

// run
//

0 comments on commit f2c79ec

Please sign in to comment.