mirror of
https://github.com/ziglang/zig.git
synced 2024-11-15 16:45:27 +00:00
parent
7d487a4162
commit
749417a1f3
@ -5881,7 +5881,7 @@ fn parseCPrimaryExpr(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!*ast.N
|
||||
},
|
||||
.Identifier => {
|
||||
const mangled_name = scope.getAlias(slice);
|
||||
return transCreateNodeIdentifier(c, mangled_name);
|
||||
return transCreateNodeIdentifier(c, checkForBuiltinTypedef(mangled_name) orelse mangled_name);
|
||||
},
|
||||
.LParen => {
|
||||
const inner_node = try parseCExpr(c, m, scope);
|
||||
|
@ -2761,12 +2761,15 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
|
||||
cases.add("macro cast",
|
||||
\\#define FOO(bar) baz((void *)(baz))
|
||||
\\#define BAR (void*) a
|
||||
\\#define BAZ (uint32_t)(2)
|
||||
, &[_][]const u8{
|
||||
\\pub inline fn FOO(bar: anytype) @TypeOf(baz((@import("std").meta.cast(?*c_void, baz)))) {
|
||||
\\ return baz((@import("std").meta.cast(?*c_void, baz)));
|
||||
\\}
|
||||
,
|
||||
\\pub const BAR = (@import("std").meta.cast(?*c_void, a));
|
||||
,
|
||||
\\pub const BAZ = (@import("std").meta.cast(u32, 2));
|
||||
});
|
||||
|
||||
cases.add("macro with cast to unsigned short, long, and long long",
|
||||
|
Loading…
Reference in New Issue
Block a user