A statement that variables whose types are or contain type parameters have variable size, and so Alignof, Offsetof, and Sizeof are not constant expressions in those cases.
They are not constant if their arguments have types that are variable size.
Fixesgolang#53921
Change-Id: I2d46754c27f55a281331c099a11ea3cd85ec4e89
Reviewed-on: https://go-review.googlesource.com/c/go/+/417917
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Rob Pike <r@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes (master)
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
go doc unsafe.Sizeof
What did you expect to see?
A statement that variables whose types are or contain type parameters have variable size, and so Alignof, Offsetof, and Sizeof are not constant expressions in those cases.
What did you see instead?
This implies that https://go.dev/play/p/ZcHTDWGcQgG should compile, but it does not.
Partially related: #40322
@gopherbot please add label Documentation
The text was updated successfully, but these errors were encountered: