mirror of
https://github.com/ziglang/zig.git
synced 2026-01-21 06:45:24 +00:00
parent
6cddf9d723
commit
924dd674e2
@ -17695,6 +17695,8 @@ static IrInstruction *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionPh
|
||||
peer_parent->resolved_type = ir_resolve_peer_types(ira,
|
||||
peer_parent->base.source_instruction->source_node, expected_type, instructions,
|
||||
peer_parent->peers.length);
|
||||
if (type_is_invalid(peer_parent->resolved_type))
|
||||
return ira->codegen->invalid_instruction;
|
||||
|
||||
// the logic below assumes there are no instructions in the new current basic block yet
|
||||
ir_assert(ira->new_irb.current_basic_block->instruction_list.length == 0, &phi_instruction->base);
|
||||
|
||||
@ -2,6 +2,18 @@ const tests = @import("tests.zig");
|
||||
const builtin = @import("builtin");
|
||||
|
||||
pub fn addCases(cases: *tests.CompileErrorContext) void {
|
||||
cases.add(
|
||||
"missing result type for phi node",
|
||||
\\fn foo() !void {
|
||||
\\ return anyerror.Foo;
|
||||
\\}
|
||||
\\export fn entry() void {
|
||||
\\ foo() catch 0;
|
||||
\\}
|
||||
,
|
||||
"tmp.zig:5:17: error: integer value 0 cannot be coerced to type 'void'",
|
||||
);
|
||||
|
||||
cases.add(
|
||||
"atomicrmw with enum op not .Xchg",
|
||||
\\export fn entry() void {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user