github.com/switchupcb/yaegi@v0.10.2/_test/unsafe1.go (about)

     1  package main
     2  
     3  import "unsafe"
     4  
     5  type S struct {
     6  	Name string
     7  }
     8  
     9  func main() {
    10  	s := &S{Name: "foobar"}
    11  
    12  	p := unsafe.Pointer(s)
    13  
    14  	s2 := (*S)(p)
    15  
    16  	println(s2.Name)
    17  }
    18  
    19  // Output:
    20  // foobar