| ... | ... | @@ -1070,6 +1070,23 @@ test "tag name with signed enum values" { |
| 1070 | 1070 | try expect(mem.eql(u8, @tagName(b), "bravo")); |
| 1071 | 1071 | } |
| 1072 | 1072 | |
| 1073 | test "@tagName in callconv(.c) function" { |
| 1074 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 1075 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 1076 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; |
| 1077 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 1078 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 1079 | |
| 1080 | try expect(mem.orderZ(u8, testEnumTagNameCallconvC(), "Two") == .eq); |
| 1081 | comptime assert(mem.orderZ(u8, testEnumTagNameCallconvC(), "Two") == .eq); |
| 1082 | } |
| 1083 | |
| 1084 | fn testEnumTagNameCallconvC() callconv(.c) [*:0]const u8 { |
| 1085 | var e: BareNumber = .Two; |
| 1086 | _ = &e; |
| 1087 | return @tagName(e); |
| 1088 | } |
| 1089 | |
| 1073 | 1090 | test "enum literal casting to optional" { |
| 1074 | 1091 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 1075 | 1092 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |