mirror of
https://github.com/ziglang/zig.git
synced 2025-01-07 10:45:17 +00:00
translate-c: fix clobbering primitive types
This commit is contained in:
parent
8d5c4a67a7
commit
26096e79d1
@ -400,6 +400,9 @@ static AstNode *get_global(Context *c, Buf *name) {
|
|||||||
if (entry)
|
if (entry)
|
||||||
return entry->value;
|
return entry->value;
|
||||||
}
|
}
|
||||||
|
if (c->codegen->primitive_type_table.maybe_get(name) != nullptr) {
|
||||||
|
return trans_create_node_symbol(c, name);
|
||||||
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1162,4 +1162,14 @@ pub fn addCases(cases: &tests.TranslateCContext) {
|
|||||||
\\ return ~x;
|
\\ return ~x;
|
||||||
\\}
|
\\}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
cases.add("primitive types included in defined symbols",
|
||||||
|
\\int foo(int u32) {
|
||||||
|
\\ return u32;
|
||||||
|
\\}
|
||||||
|
,
|
||||||
|
\\pub fn foo(u32_0: c_int) -> c_int {
|
||||||
|
\\ return u32_0;
|
||||||
|
\\}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user