Debian Codegraph @

test/typeparam/issue50993.go

raw
1 // compile -d=checkptr
2
3 // Copyright 2022 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
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 // Prev *Node[T]
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 }