CBE: handle returning undefined for ErrorUnion
Just like for Struct in 8238d4b335, in the
case of ErrorUnion struct we need to return a compound literal "(T){...}"
instead of just "{}", which is invalid code when used in e.g. a "return"
expression.
This commit is contained in:
committed by
Andrew Kelley
parent
032c722d20
commit
d127c1d59e
@@ -580,7 +580,7 @@ pub const DeclGen = struct {
|
||||
64 => return writer.writeAll("(void *)0xaaaaaaaaaaaaaaaa"),
|
||||
else => unreachable,
|
||||
},
|
||||
.Struct => {
|
||||
.Struct, .ErrorUnion => {
|
||||
try writer.writeByte('(');
|
||||
try dg.renderTypecast(writer, ty);
|
||||
return writer.writeAll("){0xaa}");
|
||||
|
||||
Reference in New Issue
Block a user