diff --git a/src/ir.cpp b/src/ir.cpp index 14adf6fbd64694eac601c8d5e6aa780ff58c391a..52b59ddcadafc0b08e448abceaaadd984fa3a638 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -17673,8 +17673,7 @@ static IrInstruction *ir_analyze_container_member_access_inner(IrAnalyze *ira, if (!is_slice(bare_struct_type)) { ScopeDecls *container_scope = get_container_scope(bare_struct_type); assert(container_scope != nullptr); - auto entry = container_scope->decl_table.maybe_get(field_name); - Tld *tld = entry ? entry->value : nullptr; + auto tld = find_container_decl(ira->codegen, container_scope, field_name); if (tld) { if (tld->id == TldIdFn) { resolve_top_level_decl(ira->codegen, tld, source_instr->source_node, false); diff --git a/test/stage1/behavior.zig b/test/stage1/behavior.zig index 8696ddfaa33c84af066a8d2e55d9a4702865c3e5..95cb98f8eb4d65ef198665ddc179bf7aa6ea2527 100644 --- a/test/stage1/behavior.zig +++ b/test/stage1/behavior.zig @@ -34,6 +34,7 @@ comptime { _ = @import("behavior/bugs/2692.zig"); _ = @import("behavior/bugs/3046.zig"); _ = @import("behavior/bugs/3112.zig"); + _ = @import("behavior/bugs/3367.zig"); _ = @import("behavior/bugs/394.zig"); _ = @import("behavior/bugs/421.zig"); _ = @import("behavior/bugs/529.zig"); diff --git a/test/stage1/behavior/bugs/3367.zig b/test/stage1/behavior/bugs/3367.zig new file mode 100644 index 0000000000000000000000000000000000000000..06b633df67e4e8a601139eaf018fec32555d2ccb --- /dev/null +++ b/test/stage1/behavior/bugs/3367.zig @@ -0,0 +1,15 @@ +const std = @import("std"); +const expect = std.testing.expect; + +const Foo = struct { + usingnamespace Mixin; +}; + +const Mixin = struct { + pub fn two(self: Foo) void {} +}; + +test "container member access usingnamespace decls" { + var foo = Foo{}; + foo.two(); +}