export fn main() void = {
// the problem occurs whenever the unbounded array is used: indexing, slicing, passing into a C-style variadic function, etc.
([]: [*]int)[0];
};
"qbe:/home/sebastian/.cache/hare/var/tmp/t.ha/b76c4e4d64e61251.ssa:14: invalid alloc size -1"
On a similar note: the spec currently says that any non-zero-size type can be passed into a C-style variadic function (and I think it makes sense to change this to also allow zero-size types once we allow zero-size bindings, just for consistency with other function calls), but it never disallows types with undefined size. Maybe we should explicitly disallow this? That being said, such a provision probably isn't necessary, provided that we take care of all other edge cases with undefined-size types, so having an object with such a type to pass in at all isn't allowed. But it might still be good to have regardless?
The same thing happens when casting to
[_]int
:[1]: [_]int;which probably shouldn't be allowed in the first place.
Alexey Yerin referenced this ticket in commit eb38743.
Alexey Yerin referenced this ticket in commit eb38743.