From 2b4b03d301ee12126f3bb5ce1d350bac7ad48b84 Mon Sep 17 00:00:00 2001 From: Tadeo Kondrak Date: Fri, 25 Sep 2020 14:29:03 -0600 Subject: Update zig files for opaque type syntax --- test/compile_errors.zig | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'test/compile_errors.zig') diff --git a/test/compile_errors.zig b/test/compile_errors.zig index 816d569b4d..f19e3c44c1 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -180,7 +180,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { \\ .layout = .Auto, \\ .tag_type = null, \\ .fields = &[_]TypeInfo.UnionField{ - \\ .{ .name = "foo", .field_type = @Type(.Opaque), .alignment = 1 }, + \\ .{ .name = "foo", .field_type = opaque {}, .alignment = 1 }, \\ }, \\ .decls = &[_]TypeInfo.Declaration{}, \\ }, @@ -2613,7 +2613,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { }); cases.add("directly embedding opaque type in struct and union", - \\const O = @Type(.Opaque); + \\const O = opaque {}; \\const Foo = struct { \\ o: O, \\}; @@ -2628,7 +2628,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { \\ var bar: Bar = undefined; \\} \\export fn c() void { - \\ var baz: *@Type(.Opaque) = undefined; + \\ var baz: *opaque {} = undefined; \\ const qux = .{baz.*}; \\} , &[_][]const u8{ @@ -3592,7 +3592,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { }); cases.add("unknown length pointer to opaque", - \\export const T = [*]@Type(.Opaque); + \\export const T = [*]opaque {}; , &[_][]const u8{ "tmp.zig:1:21: error: unknown-length pointer to opaque", }); @@ -6827,8 +6827,8 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { "tmp.zig:2:31: error: index 2 outside array of size 2", }); - cases.add("wrong pointer coerced to pointer to @Type(.Opaque)", - \\const Derp = @Type(.Opaque); + cases.add("wrong pointer coerced to pointer to opaque {}", + \\const Derp = opaque {}; \\extern fn bar(d: *Derp) void; \\export fn foo() void { \\ var x = @as(u8, 1); @@ -6854,8 +6854,8 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { \\export fn entry5() void { \\ var d = null; \\} - \\export fn entry6(opaque: *Opaque) void { - \\ var e = opaque.*; + \\export fn entry6(opaque_: *Opaque) void { + \\ var e = opaque_.*; \\} \\export fn entry7() void { \\ var f = i32; @@ -6866,7 +6866,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { \\export fn entry9() void { \\ var z: noreturn = return; \\} - \\const Opaque = @Type(.Opaque); + \\const Opaque = opaque {}; \\const Foo = struct { \\ fn bar(self: *const Foo) void {} \\}; @@ -7020,7 +7020,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { }); cases.add("field access of opaque type", - \\const MyType = @Type(.Opaque); + \\const MyType = opaque {}; \\ \\export fn entry() bool { \\ var x: i32 = 1; @@ -7623,7 +7623,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { }); cases.add("function returning opaque type", - \\const FooType = @Type(.Opaque); + \\const FooType = opaque {}; \\export fn bar() !FooType { \\ return error.InvalidValue; \\} @@ -7641,7 +7641,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { }); cases.add("generic function returning opaque type", - \\const FooType = @Type(.Opaque); + \\const FooType = opaque {}; \\fn generic(comptime T: type) !T { \\ return undefined; \\} @@ -7665,7 +7665,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { }); cases.add("function parameter is opaque", - \\const FooType = @Type(.Opaque); + \\const FooType = opaque {}; \\export fn entry1() void { \\ const someFuncPtr: fn (FooType) void = undefined; \\} -- cgit v1.2.3 From d71f339395f8a3a3c09bbb2d51e6f35cb5295d14 Mon Sep 17 00:00:00 2001 From: Tadeo Kondrak Date: Fri, 25 Sep 2020 17:14:13 -0600 Subject: stage1: disallow fields in opaque types --- src/stage1/analyze.cpp | 16 ++++++++++++---- test/compile_errors.zig | 10 ++++++++++ 2 files changed, 22 insertions(+), 4 deletions(-) (limited to 'test/compile_errors.zig') diff --git a/src/stage1/analyze.cpp b/src/stage1/analyze.cpp index 6008496fe2..b22f0ef393 100644 --- a/src/stage1/analyze.cpp +++ b/src/stage1/analyze.cpp @@ -3457,10 +3457,18 @@ static Error resolve_union_zero_bits(CodeGen *g, ZigType *union_type) { } static Error resolve_opaque_type(CodeGen *g, ZigType *opaque_type) { - opaque_type->abi_align = UINT32_MAX; - opaque_type->abi_size = SIZE_MAX; - opaque_type->size_in_bits = SIZE_MAX; - return ErrorNone; + Error err = ErrorNone; + AstNode *container_node = opaque_type->data.opaque.decl_node; + if (container_node != nullptr) { + assert(container_node->type == NodeTypeContainerDecl); + AstNodeContainerDecl *container_decl = &container_node->data.container_decl; + for (int i = 0; i < container_decl->fields.length; i++) { + AstNode *field_node = container_decl->fields.items[i]; + add_node_error(g, field_node, buf_create_from_str("opaque types cannot have fields")); + err = ErrorSemanticAnalyzeFail; + } + } + return err; } void append_namespace_qualification(CodeGen *g, Buf *buf, ZigType *container_type) { diff --git a/test/compile_errors.zig b/test/compile_errors.zig index f19e3c44c1..6c2e96fc5e 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -125,6 +125,16 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { "tmp.zig:15:23: error: enum field missing: 'arst'", "tmp.zig:27:24: note: referenced here", }); + + cases.add("opaque type with field", + \\const Opaque = opaque { foo: i32 }; + \\export fn entry() void { + \\ const foo: ?*Opaque = null; + \\} + , &[_][]const u8{ + "tmp.zig:1:25: error: opaque types cannot have fields", + }); + cases.add("@Type(.Fn) with is_generic = true", \\const Foo = @Type(.{ \\ .Fn = .{ -- cgit v1.2.3 From bf4bfe54ac13512d7553a7be83ae19e908e9c294 Mon Sep 17 00:00:00 2001 From: Tadeo Kondrak Date: Sat, 26 Sep 2020 11:55:56 -0600 Subject: Update compile error test for field access of opaque type --- src/stage1/ir.cpp | 2 ++ test/compile_errors.zig | 30 +++++++++++++++--------------- 2 files changed, 17 insertions(+), 15 deletions(-) (limited to 'test/compile_errors.zig') diff --git a/src/stage1/ir.cpp b/src/stage1/ir.cpp index ad58f23ec3..002b7f3c87 100644 --- a/src/stage1/ir.cpp +++ b/src/stage1/ir.cpp @@ -22387,6 +22387,8 @@ static IrInstGen *ir_analyze_container_member_access_inner(IrAnalyze *ira, prefix_name = "enum "; } else if (bare_struct_type->id == ZigTypeIdUnion) { prefix_name = "union "; + } else if (bare_struct_type->id == ZigTypeIdOpaque) { + prefix_name = "opaque type "; } else { prefix_name = ""; } diff --git a/test/compile_errors.zig b/test/compile_errors.zig index 6c2e96fc5e..d5c4fd3ec1 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -126,6 +126,21 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { "tmp.zig:27:24: note: referenced here", }); + cases.add("field access of opaque type", + \\const MyType = opaque {}; + \\ + \\export fn entry() bool { + \\ var x: i32 = 1; + \\ return bar(@ptrCast(*MyType, &x)); + \\} + \\ + \\fn bar(x: *MyType) bool { + \\ return x.blah; + \\} + , &[_][]const u8{ + "tmp.zig:9:13: error: no member named 'blah' in opaque type 'MyType'", + }); + cases.add("opaque type with field", \\const Opaque = opaque { foo: i32 }; \\export fn entry() void { @@ -7029,21 +7044,6 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { "tmp.zig:37:29: error: cannot store runtime value in compile time variable", }); - cases.add("field access of opaque type", - \\const MyType = opaque {}; - \\ - \\export fn entry() bool { - \\ var x: i32 = 1; - \\ return bar(@ptrCast(*MyType, &x)); - \\} - \\ - \\fn bar(x: *MyType) bool { - \\ return x.blah; - \\} - , &[_][]const u8{ - "tmp.zig:9:13: error: type '*MyType' does not support field access", - }); - cases.add("invalid legacy unicode escape", \\export fn entry() void { \\ const a = '\U1234'; -- cgit v1.2.3 From ae161863db544e2db20ba7705bf0ada7d3ce5c94 Mon Sep 17 00:00:00 2001 From: pfg Date: Tue, 6 Oct 2020 22:38:36 -0700 Subject: stage1: improve error messages for missing `try` statements --- src/stage1/ir.cpp | 8 ++++++-- test/compile_errors.zig | 10 +++++----- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'test/compile_errors.zig') diff --git a/src/stage1/ir.cpp b/src/stage1/ir.cpp index ebda9b88f6..2ec615f6b4 100644 --- a/src/stage1/ir.cpp +++ b/src/stage1/ir.cpp @@ -20102,7 +20102,7 @@ static IrInstGen *ir_analyze_store_ptr(IrAnalyze *ira, IrInst* source_instr, if (uncasted_value->value->type->id == ZigTypeIdErrorUnion || uncasted_value->value->type->id == ZigTypeIdErrorSet) { - ir_add_error(ira, source_instr, buf_sprintf("error is discarded")); + ir_add_error(ira, source_instr, buf_sprintf("error is discarded. consider using `try`, `catch`, or `if`")); return ira->codegen->invalid_inst_gen; } return ir_const_void(ira, source_instr); @@ -29492,7 +29492,11 @@ static IrInstGen *ir_analyze_instruction_check_statement_is_void(IrAnalyze *ira, return ira->codegen->invalid_inst_gen; if (statement_type->id != ZigTypeIdVoid && statement_type->id != ZigTypeIdUnreachable) { - ir_add_error(ira, &instruction->base.base, buf_sprintf("expression value is ignored")); + if(statement_type->id == ZigTypeIdErrorUnion || statement_type->id == ZigTypeIdErrorSet) { + ir_add_error(ira, &instruction->base.base, buf_sprintf("error is ignored. consider using `try`, `catch`, or `if`")); + }else{ + ir_add_error(ira, &instruction->base.base, buf_sprintf("expression value is ignored")); + } } return ir_const_void(ira, &instruction->base.base); diff --git a/test/compile_errors.zig b/test/compile_errors.zig index 816d569b4d..a733240d57 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -2287,7 +2287,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { \\ return error.OutOfMemory; \\} , &[_][]const u8{ - "tmp.zig:2:12: error: error is discarded", + "tmp.zig:2:12: error: error is discarded. consider using `try`, `catch`, or `if`", }); cases.add("volatile on global assembly", @@ -2338,9 +2338,9 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { \\ return error.Bad; \\} , &[_][]const u8{ - "tmp.zig:2:24: error: expression value is ignored", - "tmp.zig:6:25: error: expression value is ignored", - "tmp.zig:10:25: error: expression value is ignored", + "tmp.zig:2:24: error: error is ignored. consider using `try`, `catch`, or `if`", + "tmp.zig:6:25: error: error is ignored. consider using `try`, `catch`, or `if`", + "tmp.zig:10:25: error: error is ignored. consider using `try`, `catch`, or `if`", }); cases.add("empty while loop body", @@ -6236,7 +6236,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { \\} \\fn bar() anyerror!i32 { return 0; } , &[_][]const u8{ - "tmp.zig:2:14: error: expression value is ignored", + "tmp.zig:2:14: error: error is ignored. consider using `try`, `catch`, or `if`", }); cases.add("dereference an array", -- cgit v1.2.3 From 0e57f220fb71efefa9c6246818758d9c30994f73 Mon Sep 17 00:00:00 2001 From: Tadeo Kondrak Date: Mon, 5 Oct 2020 16:39:51 -0600 Subject: stage1: Disallow arrays in function parameters or return types Closes #6535. --- src/stage1/analyze.cpp | 51 ++++++++++++++++++++++++++-------------------- src/stage1/analyze.hpp | 8 +++++++- src/stage1/ir.cpp | 4 ++-- test/compile_errors.zig | 13 ++++++++++++ test/stage1/c_abi/cfuncs.c | 18 ---------------- test/stage1/c_abi/main.zig | 11 ---------- 6 files changed, 51 insertions(+), 54 deletions(-) (limited to 'test/compile_errors.zig') diff --git a/src/stage1/analyze.cpp b/src/stage1/analyze.cpp index bc9d265bd1..fb1360727c 100644 --- a/src/stage1/analyze.cpp +++ b/src/stage1/analyze.cpp @@ -1754,7 +1754,7 @@ static Error emit_error_unless_type_allowed_in_packed_union(CodeGen *g, ZigType return emit_error_unless_type_allowed_in_packed_container(g, type_entry, source_node, "union"); } -Error type_allowed_in_extern(CodeGen *g, ZigType *type_entry, bool *result) { +Error type_allowed_in_extern(CodeGen *g, ZigType *type_entry, ExternPosition position, bool *result) { Error err; switch (type_entry->id) { case ZigTypeIdInvalid: @@ -1773,8 +1773,10 @@ Error type_allowed_in_extern(CodeGen *g, ZigType *type_entry, bool *result) { case ZigTypeIdAnyFrame: *result = false; return ErrorNone; - case ZigTypeIdOpaque: case ZigTypeIdUnreachable: + *result = position == ExternPositionFunctionReturn; + return ErrorNone; + case ZigTypeIdOpaque: case ZigTypeIdBool: *result = true; return ErrorNone; @@ -1792,23 +1794,27 @@ Error type_allowed_in_extern(CodeGen *g, ZigType *type_entry, bool *result) { return ErrorNone; } case ZigTypeIdVector: - return type_allowed_in_extern(g, type_entry->data.vector.elem_type, result); + return type_allowed_in_extern(g, type_entry->data.vector.elem_type, ExternPositionOther, result); case ZigTypeIdFloat: *result = true; return ErrorNone; case ZigTypeIdArray: - return type_allowed_in_extern(g, type_entry->data.array.child_type, result); + if ((err = type_allowed_in_extern(g, type_entry->data.array.child_type, ExternPositionOther, result))) + return err; + *result = *result && + position != ExternPositionFunctionParameter && + position != ExternPositionFunctionReturn; + return ErrorNone; case ZigTypeIdFn: *result = !calling_convention_allows_zig_types(type_entry->data.fn.fn_type_id.cc); return ErrorNone; case ZigTypeIdPointer: if ((err = type_resolve(g, type_entry, ResolveStatusZeroBitsKnown))) return err; - if (!type_has_bits(g, type_entry)) { - *result = false; - return ErrorNone; - } - *result = true; + bool has_bits; + if ((err = type_has_bits2(g, type_entry, &has_bits))) + return err; + *result = has_bits; return ErrorNone; case ZigTypeIdStruct: *result = type_entry->data.structure.layout == ContainerLayoutExtern || @@ -1820,23 +1826,24 @@ Error type_allowed_in_extern(CodeGen *g, ZigType *type_entry, bool *result) { *result = false; return ErrorNone; } - if (!type_is_nonnull_ptr(g, child_type)) { + bool is_nonnull_ptr; + if ((err = type_is_nonnull_ptr2(g, child_type, &is_nonnull_ptr))) + return err; + if (!is_nonnull_ptr) { *result = false; return ErrorNone; } - return type_allowed_in_extern(g, child_type, result); + return type_allowed_in_extern(g, child_type, ExternPositionOther, result); } case ZigTypeIdEnum: { if ((err = type_resolve(g, type_entry, ResolveStatusZeroBitsKnown))) return err; ZigType *tag_int_type = type_entry->data.enumeration.tag_int_type; - if (type_entry->data.enumeration.has_explicit_tag_type) { - return type_allowed_in_extern(g, tag_int_type, result); - } else { - *result = type_entry->data.enumeration.layout == ContainerLayoutExtern || - type_entry->data.enumeration.layout == ContainerLayoutPacked; - return ErrorNone; - } + if (type_entry->data.enumeration.has_explicit_tag_type) + return type_allowed_in_extern(g, tag_int_type, position, result); + *result = type_entry->data.enumeration.layout == ContainerLayoutExtern || + type_entry->data.enumeration.layout == ContainerLayoutPacked; + return ErrorNone; } case ZigTypeIdUnion: *result = type_entry->data.unionation.layout == ContainerLayoutExtern || @@ -1933,7 +1940,7 @@ static ZigType *analyze_fn_type(CodeGen *g, AstNode *proto_node, Scope *child_sc if (!calling_convention_allows_zig_types(fn_type_id.cc)) { bool ok_type; - if ((err = type_allowed_in_extern(g, type_entry, &ok_type))) + if ((err = type_allowed_in_extern(g, type_entry, ExternPositionFunctionParameter, &ok_type))) return g->builtin_types.entry_invalid; if (!ok_type) { add_node_error(g, param_node->data.param_decl.type, @@ -2038,7 +2045,7 @@ static ZigType *analyze_fn_type(CodeGen *g, AstNode *proto_node, Scope *child_sc if ((err = type_resolve(g, fn_type_id.return_type, ResolveStatusSizeKnown))) return g->builtin_types.entry_invalid; bool ok_type; - if ((err = type_allowed_in_extern(g, fn_type_id.return_type, &ok_type))) + if ((err = type_allowed_in_extern(g, fn_type_id.return_type, ExternPositionFunctionReturn, &ok_type))) return g->builtin_types.entry_invalid; if (!ok_type) { add_node_error(g, fn_proto->return_type, @@ -2357,7 +2364,7 @@ static Error resolve_struct_type(CodeGen *g, ZigType *struct_type) { if (struct_type->data.structure.layout == ContainerLayoutExtern) { bool ok_type; - if ((err = type_allowed_in_extern(g, field_type, &ok_type))) { + if ((err = type_allowed_in_extern(g, field_type, ExternPositionOther, &ok_type))) { struct_type->data.structure.resolve_status = ResolveStatusInvalid; return ErrorSemanticAnalyzeFail; } @@ -2612,7 +2619,7 @@ static Error type_is_valid_extern_enum_tag(CodeGen *g, ZigType *ty, bool *result // signed char, a signed integer or an unsigned one. But GCC/Clang allow // other integral types as a compiler extension so let's accomodate them // aswell. - return type_allowed_in_extern(g, ty, result); + return type_allowed_in_extern(g, ty, ExternPositionOther, result); } static Error resolve_enum_zero_bits(CodeGen *g, ZigType *enum_type) { diff --git a/src/stage1/analyze.hpp b/src/stage1/analyze.hpp index 07601e6dea..d7a67826d5 100644 --- a/src/stage1/analyze.hpp +++ b/src/stage1/analyze.hpp @@ -50,7 +50,13 @@ bool handle_is_ptr(CodeGen *g, ZigType *type_entry); bool type_has_bits(CodeGen *g, ZigType *type_entry); Error type_has_bits2(CodeGen *g, ZigType *type_entry, bool *result); -Error type_allowed_in_extern(CodeGen *g, ZigType *type_entry, bool *result); +enum ExternPosition { + ExternPositionFunctionParameter, + ExternPositionFunctionReturn, + ExternPositionOther, // array element, struct field, optional element, etc +}; + +Error type_allowed_in_extern(CodeGen *g, ZigType *type_entry, ExternPosition position, bool *result); bool ptr_allows_addr_zero(ZigType *ptr_type); // Deprecated, use `type_is_nonnull_ptr2` diff --git a/src/stage1/ir.cpp b/src/stage1/ir.cpp index 5ab667e831..c90f5f6309 100644 --- a/src/stage1/ir.cpp +++ b/src/stage1/ir.cpp @@ -18963,7 +18963,7 @@ static IrInstGen *ir_analyze_instruction_export(IrAnalyze *ira, IrInstSrcExport break; case ZigTypeIdArray: { bool ok_type; - if ((err = type_allowed_in_extern(ira->codegen, target->value->type->data.array.child_type, &ok_type))) + if ((err = type_allowed_in_extern(ira->codegen, target->value->type->data.array.child_type, ExternPositionOther, &ok_type))) return ira->codegen->invalid_inst_gen; if (!ok_type) { @@ -32745,7 +32745,7 @@ static Error ir_resolve_lazy_raw(AstNode *source_node, ZigValue *val) { return ErrorSemanticAnalyzeFail; } else if (lazy_ptr_type->ptr_len == PtrLenC) { bool ok_type; - if ((err = type_allowed_in_extern(ira->codegen, elem_type, &ok_type))) + if ((err = type_allowed_in_extern(ira->codegen, elem_type, ExternPositionOther, &ok_type))) return err; if (!ok_type) { ir_add_error(ira, &lazy_ptr_type->elem_type->base, diff --git a/test/compile_errors.zig b/test/compile_errors.zig index 3156876959..44ee58f002 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -2,6 +2,19 @@ const tests = @import("tests.zig"); const std = @import("std"); pub fn addCases(cases: *tests.CompileErrorContext) void { + cases.add("array in c exported function", + \\export fn zig_array(x: [10]u8) void { + \\ expect(std.mem.eql(u8, &x, "1234567890")); + \\} + \\ + \\export fn zig_return_array() [10]u8 { + \\ return "1234567890".*; + \\} + , &[_][]const u8{ + "tmp.zig:1:24: error: parameter of type '[10]u8' not allowed in function with calling convention 'C'", + "tmp.zig:5:30: error: return type '[10]u8' not allowed in function with calling convention 'C'", + }); + cases.add("@Type for exhaustive enum with undefined tag type", \\const TypeInfo = @import("builtin").TypeInfo; \\const Tag = @Type(.{ diff --git a/test/stage1/c_abi/cfuncs.c b/test/stage1/c_abi/cfuncs.c index 0e7bd2906f..0e8204779a 100644 --- a/test/stage1/c_abi/cfuncs.c +++ b/test/stage1/c_abi/cfuncs.c @@ -28,8 +28,6 @@ void zig_ptr(void *); void zig_bool(bool); -void zig_array(uint8_t[10]); - struct BigStruct { uint64_t a; uint64_t b; @@ -97,9 +95,6 @@ void run_c_tests(void) { zig_bool(true); - uint8_t array[10] = {'1', '2', '3', '4', '5', '6', '7', '8', '9', '0'}; - zig_array(array); - { struct BigStruct s = {1, 2, 3, 4, 5}; zig_big_struct(s); @@ -190,19 +185,6 @@ void c_five_floats(float a, float b, float c, float d, float e) { assert_or_panic(e == 5.0); } -void c_array(uint8_t x[10]) { - assert_or_panic(x[0] == '1'); - assert_or_panic(x[1] == '2'); - assert_or_panic(x[2] == '3'); - assert_or_panic(x[3] == '4'); - assert_or_panic(x[4] == '5'); - assert_or_panic(x[5] == '6'); - assert_or_panic(x[6] == '7'); - assert_or_panic(x[7] == '8'); - assert_or_panic(x[8] == '9'); - assert_or_panic(x[9] == '0'); -} - void c_big_struct(struct BigStruct x) { assert_or_panic(x.a == 1); assert_or_panic(x.b == 2); diff --git a/test/stage1/c_abi/main.zig b/test/stage1/c_abi/main.zig index 9090bb481e..18e9858da4 100644 --- a/test/stage1/c_abi/main.zig +++ b/test/stage1/c_abi/main.zig @@ -116,17 +116,6 @@ export fn zig_bool(x: bool) void { expect(x); } -extern fn c_array([10]u8) void; - -test "C ABI array" { - var array: [10]u8 = "1234567890".*; - c_array(array); -} - -export fn zig_array(x: [10]u8) void { - expect(std.mem.eql(u8, &x, "1234567890")); -} - const BigStruct = extern struct { a: u64, b: u64, -- cgit v1.2.3