forked from ziglang/zig
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use mem.zeroes for empty union initializer list
- Loading branch information
1 parent
fc48bbd
commit d7a27bf
Showing
3 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
union U { | ||
int x; | ||
long y; | ||
}; | ||
|
||
void foo(void) { | ||
union U u = {}; | ||
} | ||
// translate-c | ||
// target=x86_64-linux | ||
// c_frontend=clang | ||
// | ||
// pub const union_U = extern union { | ||
// x: c_int, | ||
// y: c_long, | ||
// }; | ||
// pub export fn foo() void { | ||
// var u: union_U = @import("std").mem.zeroes(union_U); | ||
// _ = &u; | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters