Source file
test/typeparam/issue50993.go
1
2
3
4
5
6
7 package main
8
9 import (
10 "sync/atomic"
11 "unsafe"
12 )
13
14 type Node[T any] struct {
15 Next *Node[T]
16
17 }
18
19 func LoadPointer[T any](addr **T) (val *T) {
20 return (*T)(
21 atomic.LoadPointer(
22 (*unsafe.Pointer)(unsafe.Pointer(addr)),
23 ))
24 }
25
26 func (q *Node[T]) Pop() {
27 var tail, head *Node[T]
28 if head == LoadPointer(&tail) {
29 }
30 }
31
32 func main() {
33 ch := Node[uint64]{}
34 ch.Pop()
35 }
36
View as plain text