Skip to content

Commit 0dfdf32

Browse files
mateusz834mknyszek
authored andcommitted
[release-branch.go1.19] sync/atomic: disallow type conversions of atomic.Pointer[T]
For #56603. Fixes #56638. Change-Id: I6af9d80201025ae4028bfaa4a62e5de9ac0c501d GitHub-Last-Rev: e6ed5e1 GitHub-Pull-Request: #56604 Reviewed-on: https://go-review.googlesource.com/c/go/+/448275 Reviewed-by: Michael Knyszek <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> (cherry picked from commit 6bead8f) Reviewed-on: https://go-review.googlesource.com/c/go/+/448518 Run-TryBot: Michael Knyszek <[email protected]>
1 parent ec65108 commit 0dfdf32

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/sync/atomic/type.go

+4
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ func b32(b bool) uint32 {
3737

3838
// A Pointer is an atomic pointer of type *T. The zero value is a nil *T.
3939
type Pointer[T any] struct {
40+
// Mention T in a field to disallow conversion between Pointer types.
41+
// See go.dev/issue/56603 for more details.
42+
_ [0]T
43+
4044
_ noCopy
4145
v unsafe.Pointer
4246
}

0 commit comments

Comments
 (0)