aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorVexu <git@vexu.eu>2020-03-08 12:07:26 +0200
committerVexu <git@vexu.eu>2020-03-08 12:11:37 +0200
commit692a974c3edd05944d33cd579bcb355cdd7199fc (patch)
tree029600d5411dfd9c6b8b64b2c0c3df58ac3f340a /test
parent5aa993cd617e0ae3cabc9c626e45a748857e2f2a (diff)
downloadzig-692a974c3edd05944d33cd579bcb355cdd7199fc.tar.gz
zig-692a974c3edd05944d33cd579bcb355cdd7199fc.zip
translate-c reject structs with VLAs
Diffstat (limited to 'test')
-rw-r--r--test/translate_c.zig9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/translate_c.zig b/test/translate_c.zig
index a791d0ccad..209a301f88 100644
--- a/test/translate_c.zig
+++ b/test/translate_c.zig
@@ -3,6 +3,15 @@ const std = @import("std");
const CrossTarget = std.zig.CrossTarget;
pub fn addCases(cases: *tests.TranslateCContext) void {
+ cases.add("structs with VLAs are rejected",
+ \\struct foo { int x; int y[]; };
+ \\struct bar { int x; int y[0]; };
+ , &[_][]const u8{
+ \\pub const struct_foo = @OpaqueType();
+ ,
+ \\pub const struct_bar = @OpaqueType();
+ });
+
cases.add("nested loops without blocks",
\\void foo() {
\\ while (0) while (0) {}