From: Robert Griesemer Date: Sun, 28 Nov 2021 23:25:09 +0000 (-0800) Subject: spec: adjust section on package unsafe for type parameters X-Git-Tag: go1.18beta1~158 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=61ff5019687c125910c48c22d672a9b6985ee61e;p=gostls13.git spec: adjust section on package unsafe for type parameters Change-Id: I562d4648756e710020ee491f3801896563a89baa Reviewed-on: https://go-review.googlesource.com/c/go/+/367395 Trust: Robert Griesemer Trust: Dan Scales Reviewed-by: Ian Lance Taylor --- diff --git a/doc/go_spec.html b/doc/go_spec.html index 8643d94476..2832b0739d 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -642,7 +642,7 @@ an identifier denoting a constant, a constant expression, a conversion with a result that is a constant, or the result value of some built-in functions such as -unsafe.Sizeof applied to any value, +unsafe.Sizeof applied to certain values, cap or len applied to some expressions, real and imag applied to a complex constant @@ -7446,8 +7446,14 @@ uintptr(unsafe.Pointer(&x)) % unsafe.Alignof(x) == 0

-Calls to Alignof, Offsetof, and -Sizeof are compile-time constant expressions of type uintptr. +A (variable of) type T has variable size if T +is a type parameter, or if it is an array or struct type containing elements +or fields of variable size. Otherwise the size is constant. +Calls to Alignof, Offsetof, and Sizeof +are compile-time constant expressions of +type uintptr if their arguments (or the struct s in +the selector expression s.f for Offsetof) are types +of constant size.