| author | |
| committer | |
| log | 749417a1f3060f0695bbfe72d929f06b0be42535 |
| tree | 70c8e839dd040027fc179373cfe8098cc1388125 |
| parent | 7d487a41627658bfda37f1f06f8e453c2b576b9c |
| signature | Commit is signed but in an unrecognized format. |
Closes #62922 files changed, 4 insertions(+), 1 deletions(-)
src-self-hosted/translate_c.zig+1-1| ... | ... | @@ -5881,7 +5881,7 @@ fn parseCPrimaryExpr(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!*ast.N |
| 5881 | 5881 | }, |
| 5882 | 5882 | .Identifier => { |
| 5883 | 5883 | const mangled_name = scope.getAlias(slice); |
| 5884 | return transCreateNodeIdentifier(c, mangled_name); | |
| 5884 | return transCreateNodeIdentifier(c, checkForBuiltinTypedef(mangled_name) orelse mangled_name); | |
| 5885 | 5885 | }, |
| 5886 | 5886 | .LParen => { |
| 5887 | 5887 | const inner_node = try parseCExpr(c, m, scope); |
test/translate_c.zig+3| ... | ... | @@ -2761,12 +2761,15 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2761 | 2761 | cases.add("macro cast", |
| 2762 | 2762 | \\#define FOO(bar) baz((void *)(baz)) |
| 2763 | 2763 | \\#define BAR (void*) a |
| 2764 | \\#define BAZ (uint32_t)(2) | |
| 2764 | 2765 | , &[_][]const u8{ |
| 2765 | 2766 | \\pub inline fn FOO(bar: anytype) @TypeOf(baz((@import("std").meta.cast(?*c_void, baz)))) { |
| 2766 | 2767 | \\ return baz((@import("std").meta.cast(?*c_void, baz))); |
| 2767 | 2768 | \\} |
| 2768 | 2769 | , |
| 2769 | 2770 | \\pub const BAR = (@import("std").meta.cast(?*c_void, a)); |
| 2771 | , | |
| 2772 | \\pub const BAZ = (@import("std").meta.cast(u32, 2)); | |
| 2770 | 2773 | }); |
| 2771 | 2774 | |
| 2772 | 2775 | cases.add("macro with cast to unsigned short, long, and long long", |