stage2: fix AstGen for some struct syntaxes

* AstGen: fix not emitting `struct_init_empty` when an explicit type is
   present in struct initialization syntax.
 * AstGen: these two syntaxes now lower to identical ZIR:
   - `var a = A{ .b = c };`
   - `var a = @as(A, .{ .b = c });`
 * Zir: clarify `auto_enum_tag` in the doc comments.
 * LLVM Backend: fix lowering of function return types when the type has
   0 bits.
This commit is contained in:
Andrew Kelley
2021-09-22 21:02:24 -07:00
parent 0ec01e58b4
commit 736d14fd5f
6 changed files with 1028 additions and 962 deletions

View File

@@ -563,8 +563,13 @@ pub const DeclGen = struct {
}
}
const llvm_ret_ty = if (!return_type.hasCodeGenBits())
self.context.voidType()
else
try self.llvmType(return_type);
const fn_type = llvm.functionType(
try self.llvmType(return_type),
llvm_ret_ty,
llvm_param_buffer.ptr,
llvm_params_len,
.False,