mirror of
https://github.com/ziglang/zig.git
synced 2026-02-14 05:20:34 +00:00
parent
e30f713640
commit
a461ae6c1f
10
src/ir.cpp
10
src/ir.cpp
@ -9396,10 +9396,12 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru
|
||||
}
|
||||
}
|
||||
ScopeDecls *container_scope = get_container_scope(child_type);
|
||||
auto entry = container_scope->decl_table.maybe_get(field_name);
|
||||
Tld *tld = entry ? entry->value : nullptr;
|
||||
if (tld) {
|
||||
return ir_analyze_decl_ref(ira, &field_ptr_instruction->base, tld);
|
||||
if (container_scope != nullptr) {
|
||||
auto entry = container_scope->decl_table.maybe_get(field_name);
|
||||
Tld *tld = entry ? entry->value : nullptr;
|
||||
if (tld) {
|
||||
return ir_analyze_decl_ref(ira, &field_ptr_instruction->base, tld);
|
||||
}
|
||||
}
|
||||
ir_add_error(ira, &field_ptr_instruction->base,
|
||||
buf_sprintf("container '%s' has no member called '%s'",
|
||||
|
||||
@ -1848,6 +1848,12 @@ fn doSomeAsm() {
|
||||
);
|
||||
}
|
||||
)SOURCE", 1, ".tmp_source.zig:7:5: error: unable to evaluate constant expression");
|
||||
|
||||
add_compile_fail_case("invalid member of builtin enum", R"SOURCE(
|
||||
export fn entry() {
|
||||
const foo = Arch.x86;
|
||||
}
|
||||
)SOURCE", 1, ".tmp_source.zig:3:21: error: container 'Arch' has no member called 'x86'");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user