diff options
author | Robert Griesemer <gri@golang.org> | 2021-07-18 15:51:31 -0700 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2021-07-22 17:53:51 +0000 |
commit | 80127a7dfe6951fb16d2b67dbe9badb5952e3a2f (patch) | |
tree | 50cc3650f8a1d9645ea2aa26c34044e96ac29577 /src/cmd/compile/internal/types2/testdata/fixedbugs | |
parent | fca3e5c4452e8dac6c7ae028dcccc323e1d57ed5 (diff) | |
download | go-80127a7dfe6951fb16d2b67dbe9badb5952e3a2f.tar.gz go-80127a7dfe6951fb16d2b67dbe9badb5952e3a2f.zip |
[dev.typeparams] cmd/compile/internal/types2: adjust unsafe.Alignof/Offsetof/Sizeof
Changed the implementation such that the result is a variable rather than
a constant if the argument type (or the struct in case of unsafe.Offsetof)
has a size that depends on type parameters.
Minor unrelated adjustments.
For #40301.
Change-Id: I1e988f1479b95648ad95a455c764ead829d75749
Reviewed-on: https://go-review.googlesource.com/c/go/+/335413
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Diffstat (limited to 'src/cmd/compile/internal/types2/testdata/fixedbugs')
-rw-r--r-- | src/cmd/compile/internal/types2/testdata/fixedbugs/issue40301.go2 | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/types2/testdata/fixedbugs/issue40301.go2 b/src/cmd/compile/internal/types2/testdata/fixedbugs/issue40301.go2 index 5d97855f8a..c78f9a1fa0 100644 --- a/src/cmd/compile/internal/types2/testdata/fixedbugs/issue40301.go2 +++ b/src/cmd/compile/internal/types2/testdata/fixedbugs/issue40301.go2 @@ -7,6 +7,6 @@ package p import "unsafe" func _[T any](x T) { - _ = unsafe /* ERROR undefined */ .Alignof(x) - _ = unsafe /* ERROR undefined */ .Sizeof(x) + _ = unsafe.Alignof(x) + _ = unsafe.Sizeof(x) } |