mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
add test for missing const in slice with nested array type
This commit is contained in:
parent
ca2a788a24
commit
a33b9aec72
@ -2,6 +2,23 @@ const tests = @import("tests.zig");
|
||||
const builtin = @import("builtin");
|
||||
|
||||
pub fn addCases(cases: *tests.CompileErrorContext) void {
|
||||
cases.add(
|
||||
"missing const in slice with nested array type",
|
||||
\\const Geo3DTex2D = struct { vertices: [][2]f32 };
|
||||
\\pub fn getGeo3DTex2D() Geo3DTex2D {
|
||||
\\ return Geo3DTex2D{
|
||||
\\ .vertices = [_][2]f32{
|
||||
\\ [_]f32{ -0.5, -0.5},
|
||||
\\ },
|
||||
\\ };
|
||||
\\}
|
||||
\\export fn entry() void {
|
||||
\\ var geo_data = getGeo3DTex2D();
|
||||
\\}
|
||||
,
|
||||
"tmp.zig:4:30: error: expected type '[][2]f32', found '[1][2]f32'",
|
||||
);
|
||||
|
||||
cases.add(
|
||||
"slicing of global undefined pointer",
|
||||
\\var buf: *[1]u8 = undefined;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user