diff options
| author | Andrea Orru <andrea@orru.io> | 2018-03-13 22:07:40 -0700 |
|---|---|---|
| committer | Andrea Orru <andrea@orru.io> | 2018-03-13 22:07:40 -0700 |
| commit | c828c23f71055fc4614ada20a20fb1c7bfee50c6 (patch) | |
| tree | 2c601b10869b3ea4ee287a44ae5bf37b08445569 /test/compile_errors.zig | |
| parent | 7ac44037db686b93de25b6d826f596985d79ea42 (diff) | |
| download | zig-c828c23f71055fc4614ada20a20fb1c7bfee50c6.tar.gz zig-c828c23f71055fc4614ada20a20fb1c7bfee50c6.zip | |
Tests for zero-bit field compiler error
Diffstat (limited to 'test/compile_errors.zig')
| -rw-r--r-- | test/compile_errors.zig | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig index 564ad5d521..027e000953 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -3141,4 +3141,14 @@ pub fn addCases(cases: &tests.CompileErrorContext) void { \\} , ".tmp_source.zig:4:9: error: type 'S' is not copyable; cannot pass by value"); + + cases.add("taking offset of void field in struct", + \\const Empty = struct { + \\ val: void, + \\}; + \\export fn foo() void { + \\ const fieldOffset = @offsetOf(Empty, "val"); + \\} + , + ".tmp_source.zig:5:42: error: zero-bit field 'val' has no offset in struct 'Empty'"); } |
