llvm: handle namespace like packed structs

Closes #13159
Closes #13188
This commit is contained in:
Veikka Tuominen 2022-10-24 14:46:14 +03:00
parent dd437ae399
commit 78a7bb108a
3 changed files with 16 additions and 1 deletions

View File

@ -1916,7 +1916,7 @@ pub const Object = struct {
if (ty.castTag(.@"struct")) |payload| {
const struct_obj = payload.data;
if (struct_obj.layout == .Packed) {
if (struct_obj.layout == .Packed and struct_obj.haveFieldTypes()) {
const info = struct_obj.backing_int_ty.intInfo(target);
const dwarf_encoding: c_uint = switch (info.signedness) {
.signed => DW.ATE.signed,

View File

@ -109,6 +109,7 @@ test {
_ = @import("behavior/bugs/13128.zig");
_ = @import("behavior/bugs/13164.zig");
_ = @import("behavior/bugs/13171.zig");
_ = @import("behavior/bugs/13159.zig");
_ = @import("behavior/byteswap.zig");
_ = @import("behavior/byval_arg_var.zig");
_ = @import("behavior/call.zig");

View File

@ -0,0 +1,14 @@
const std = @import("std");
const expect = std.testing.expect;
const Bar = packed struct {
const Baz = enum {
fizz,
buzz,
};
};
test {
var foo = Bar.Baz.fizz;
try expect(foo == .fizz);
}