diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-07-22 13:20:18 +0300 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-07-23 15:40:12 +0300 |
| commit | 15dddfd84d9007689ef1fa6f4abedb88c570973a (patch) | |
| tree | 0d938db7ae94ac24235cad9656a70958832e5ea1 /test/cases | |
| parent | 0ef4cc738b9c023c1128e3767919b446c959955a (diff) | |
| download | zig-15dddfd84d9007689ef1fa6f4abedb88c570973a.tar.gz zig-15dddfd84d9007689ef1fa6f4abedb88c570973a.zip | |
AstGen: make comptime fields in packed and extern structs compile errors
Diffstat (limited to 'test/cases')
| -rw-r--r-- | test/cases/compile_errors/invalid_comptime_fields.zig | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/cases/compile_errors/invalid_comptime_fields.zig b/test/cases/compile_errors/invalid_comptime_fields.zig new file mode 100644 index 0000000000..3149a46810 --- /dev/null +++ b/test/cases/compile_errors/invalid_comptime_fields.zig @@ -0,0 +1,21 @@ +const U = union { + comptime a: u32 = 1, +}; +const E = enum { + comptime a = 1, +}; +const P = packed struct { + comptime a: u32 = 1, +}; +const X = extern struct { + comptime a: u32 = 1, +}; + +// error +// backend=stage2 +// target=native +// +// :2:5: error: union fields cannot be marked comptime +// :5:5: error: enum fields cannot be marked comptime +// :8:5: error: packed struct fields cannot be marked comptime +// :11:5: error: extern struct fields cannot be marked comptime |
