mirror of
https://github.com/ziglang/zig.git
synced 2025-01-05 18:00:25 +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)
|
||||
return entry->value;
|
||||
}
|
||||
if (c->codegen->primitive_type_table.maybe_get(name) != nullptr) {
|
||||
return trans_create_node_symbol(c, name);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -1162,4 +1162,14 @@ pub fn addCases(cases: &tests.TranslateCContext) {
|
||||
\\ 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