diff options
| -rw-r--r-- | src/codegen.cpp | 6 | ||||
| -rw-r--r-- | test/gen_h.zig | 11 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp index a44091bdbf..de8cfa31ed 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -6592,6 +6592,7 @@ static void get_c_type(CodeGen *g, GenH *gen_h, TypeTableEntry *type_entry, Buf } } case TypeTableEntryIdStruct: + case TypeTableEntryIdOpaque: { buf_init_from_str(out_buf, "struct "); buf_append_buf(out_buf, &type_entry->name); @@ -6609,11 +6610,6 @@ static void get_c_type(CodeGen *g, GenH *gen_h, TypeTableEntry *type_entry, Buf buf_append_buf(out_buf, &type_entry->name); return; } - case TypeTableEntryIdOpaque: - { - buf_init_from_buf(out_buf, &type_entry->name); - return; - } case TypeTableEntryIdArray: { TypeTableEntryArray *array_data = &type_entry->data.array; diff --git a/test/gen_h.zig b/test/gen_h.zig index 5f28326ff6..30d168cf2c 100644 --- a/test/gen_h.zig +++ b/test/gen_h.zig @@ -51,6 +51,16 @@ pub fn addCases(cases: &tests.GenHContext) void { \\ ); + cases.add("declare opaque type", + \\export const Foo = @OpaqueType(); + \\ + \\export fn entry(foo: ?&Foo) void { } + , + \\struct Foo; + \\ + \\TEST_EXPORT void entry(struct Foo * foo); + ); + cases.add("array field-type", \\const Foo = extern struct { \\ A: [2]i32, @@ -66,4 +76,5 @@ pub fn addCases(cases: &tests.GenHContext) void { \\TEST_EXPORT void entry(struct Foo foo, uint8_t bar[]); \\ ); + } |
