]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile: fixes for non-constant Sizeof/Alignof/Offsetof
authorDan Scales <danscales@google.com>
Sun, 22 Aug 2021 18:50:58 +0000 (11:50 -0700)
committerDan Scales <danscales@google.com>
Mon, 23 Aug 2021 22:55:34 +0000 (22:55 +0000)
commitbe1a6934776a3c7f636932918e756b44b6510214
treeb32e04c7aa216314ccc3b5f501691697b7efa761
parent8157960d7f4a89807c71b3427a0363a23fd43ca9
cmd/compile: fixes for non-constant Sizeof/Alignof/Offsetof

Includes Robert's suggested fix in validate.go to not fail on
non-constant alignof/offsetof/sizeof calls. Further changes to wait on
transforming these calls until stenciling time, when we can call
EvalConst() to evaluate them once all the relevant types are known.

Added a bunch of new tests for non-constant Sizeof/Alignof/Offsetof.

Fixes #47716

Change-Id: I469af888eb9ce3a853124d919eda753971009b3e
Reviewed-on: https://go-review.googlesource.com/c/go/+/344250
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Dan Scales <danscales@google.com>
src/cmd/compile/internal/noder/helpers.go
src/cmd/compile/internal/noder/stencil.go
src/cmd/compile/internal/noder/transform.go
src/cmd/compile/internal/noder/validate.go
src/cmd/compile/internal/typecheck/const.go
test/typeparam/issue47716.go [new file with mode: 0644]