diff --git a/lib/std/zig/c_translation.zig b/lib/std/zig/c_translation.zig index 348e3a71331e1d6b62b5a593f1973a3384b4e252..6847a92eae9258a4da8d1aee88a94210e63f1096 100644 --- a/lib/std/zig/c_translation.zig +++ b/lib/std/zig/c_translation.zig @@ -268,7 +268,7 @@ test "sizeof" { pub const CIntLiteralRadix = enum { decimal, octal, hexadecimal }; fn PromoteIntLiteralReturnType(comptime SuffixType: type, comptime number: comptime_int, comptime radix: CIntLiteralRadix) type { - const signed_decimal = [_]type{ c_int, c_long, c_longlong }; + const signed_decimal = [_]type{ c_int, c_long, c_longlong, c_ulonglong }; const signed_oct_hex = [_]type{ c_int, c_uint, c_long, c_ulong, c_longlong, c_ulonglong }; const unsigned = [_]type{ c_uint, c_ulong, c_ulonglong }; diff --git a/test/behavior/translate_c_macros.h b/test/behavior/translate_c_macros.h index 526ab32abcc3ef50aae4b3e82e3d65107816617f..222a7ded6c4b061c3f9d7d7ac5057d8e6c3404ed 100644 --- a/test/behavior/translate_c_macros.h +++ b/test/behavior/translate_c_macros.h @@ -48,3 +48,5 @@ typedef _Bool uintptr_t; #define CAST_TO_BOOL(X) (_Bool)(X) #define CAST_TO_UINTPTR(X) (uintptr_t)(X) + +#define LARGE_INT 18446744073709550592 diff --git a/test/behavior/translate_c_macros.zig b/test/behavior/translate_c_macros.zig index 705c60aa4e2a7b848706d4dbd6aa7d1cf6db8d60..a23907c88f3b0d7e915eb30d01d120e5580e4c68 100644 --- a/test/behavior/translate_c_macros.zig +++ b/test/behavior/translate_c_macros.zig @@ -113,3 +113,7 @@ test "cast functions" { try expectEqual(true, h.CAST_TO_BOOL(S.foo)); try expect(h.CAST_TO_UINTPTR(S.foo) != 0); } + +test "large integer macro" { + try expectEqual(@as(c_ulonglong, 18446744073709550592), h.LARGE_INT); +}