| ... | ... | @@ -3916,4 +3916,36 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3916 | 3916 | \\ }) != 0) {} |
| 3917 | 3917 | \\} |
| 3918 | 3918 | }); |
| 3919 | |
| 3920 | if (builtin.os.tag == .windows) { |
| 3921 | cases.add("Pointer subtraction with typedef", |
| 3922 | \\typedef char* S; |
| 3923 | \\void foo() { |
| 3924 | \\ S a, b; |
| 3925 | \\ long long c = a - b; |
| 3926 | \\} |
| 3927 | , &[_][]const u8{ |
| 3928 | \\pub export fn foo() void { |
| 3929 | \\ var a: S = undefined; |
| 3930 | \\ var b: S = undefined; |
| 3931 | \\ var c: c_longlong = @divExact(@bitCast(c_longlong, @ptrToInt(a) -% @ptrToInt(b)), @sizeOf(u8)); |
| 3932 | \\ _ = @TypeOf(c); |
| 3933 | \\} |
| 3934 | }); |
| 3935 | } else { |
| 3936 | cases.add("Pointer subtraction with typedef", |
| 3937 | \\typedef char* S; |
| 3938 | \\void foo() { |
| 3939 | \\ S a, b; |
| 3940 | \\ long c = a - b; |
| 3941 | \\} |
| 3942 | , &[_][]const u8{ |
| 3943 | \\pub export fn foo() void { |
| 3944 | \\ var a: S = undefined; |
| 3945 | \\ var b: S = undefined; |
| 3946 | \\ var c: c_long = @divExact(@bitCast(c_long, @ptrToInt(a) -% @ptrToInt(b)), @sizeOf(u8)); |
| 3947 | \\ _ = @TypeOf(c); |
| 3948 | \\} |
| 3949 | }); |
| 3950 | } |
| 3919 | 3951 | } |