aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarc Tiehuis <marctiehuis@gmail.com>2018-03-23 20:27:11 +1300
committerMarc Tiehuis <marctiehuis@gmail.com>2018-03-23 20:27:11 +1300
commit3d1732ef6c8ebc7edf10485f61b4ec905303cd8a (patch)
tree04f6cb679eebd178db1ca0eba2652f99c102fe73 /test
parent7a99d63c764f3d5d92370c90f932b1bf156269f6 (diff)
downloadzig-3d1732ef6c8ebc7edf10485f61b4ec905303cd8a.tar.gz
zig-3d1732ef6c8ebc7edf10485f61b4ec905303cd8a.zip
Fix OpqaueType usage in exported c functions
We prefer `struct typename`. If a typedef is required, this must be done manually after generation.
Diffstat (limited to 'test')
-rw-r--r--test/gen_h.zig11
1 files changed, 11 insertions, 0 deletions
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[]);
\\
);
+
}