Skip to content

langref: improve zero bit types documentation #14385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion doc/langref.html.in
Original file line number Diff line number Diff line change
Expand Up @@ -6627,7 +6627,7 @@ test "peer type resolution: *const T and ?*T" {
<li>{#link|Arrays#} and {#link|Vectors#} with len 0, or with an element type that is a zero bit type.</li>
<li>An {#link|enum#} with only 1 tag.</li>
<li>A {#link|struct#} with all fields being zero bit types.</li>
<li>A {#link|union#} with only 1 field which is a zero bit type.</li>
<li>An {#link|union#} with all fields being zero bit types.</li>
</ul>
<p>
These types can only ever have one possible value, and thus
Expand All @@ -6650,6 +6650,9 @@ export fn entry() void {
15: c3 retq </code></pre>
<p>These assembly instructions do not have any code associated with the void values -
they only perform the function call prologue and epilogue.</p>
<p>Using empty {#link|struct#}, empty {#link|enum#}, empty {#link|union#},
and empty {#link|Error Set Type#} is problematic, and may be a compile error in the future.
For details on this subscribe to <a href="https://github.com/ziglang/zig/issues/13807">this issue</a>.

{#header_open|void#}
<p>
Expand Down