AstGen: make comptime fields in packed and extern structs compile errors

This commit is contained in:
Veikka Tuominen
2022-07-22 13:20:18 +03:00
parent 0ef4cc738b
commit 15dddfd84d
3 changed files with 30 additions and 2 deletions

View File

@@ -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