Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Const and slices, wrong const checking #1565
The first issue is that this compiles:
Buffer is constant data, the slices are to mutable data.
Here comes the weird part, I can not do this:
However, if "const buffer" is changed to "var buffer" then both now work despite sliceA's type never changing:
More (but different):
Change "const array" to "var array" and it all compiles. You can also change "const ptrA" to "var ptrA" and it also all compiles. Note that the error here is "error: out of bounds slice", it's not an error about const.
I don't know if this is a different bug or not.