mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
add compile error test case
This commit is contained in:
parent
dca4c302dd
commit
7666d5fc26
1 changed files with 16 additions and 0 deletions
|
|
@ -0,0 +1,16 @@
|
||||||
|
export fn entry() void {
|
||||||
|
_ = foo() catch {};
|
||||||
|
}
|
||||||
|
fn foo() anyerror![4]u32 {
|
||||||
|
return bar();
|
||||||
|
}
|
||||||
|
fn bar() anyerror!@Vector(4, u32) {
|
||||||
|
return .{ 1, 2, 3, 4 };
|
||||||
|
}
|
||||||
|
// error
|
||||||
|
// backend=stage2
|
||||||
|
// target=native
|
||||||
|
//
|
||||||
|
// :5:15: error: expected type 'anyerror![4]u32', found 'anyerror!@Vector(4, u32)'
|
||||||
|
// :5:15: note: error union payload '@Vector(4, u32)' cannot cast into error union payload '[4]u32'
|
||||||
|
// :4:18: note: function return type declared here
|
||||||
Loading…
Add table
Reference in a new issue