Source file test/typeparam/issue48094.dir/a.go

     1  // Copyright 2021 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package a
     6  
     7  import "unsafe"
     8  
     9  func F[T any]() uintptr {
    10  	var t T
    11  	return unsafe.Sizeof(t)
    12  }
    13  
    14  func G[T any]() uintptr {
    15  	var t T
    16  	return unsafe.Alignof(t)
    17  }
    18  
    19  //func H[T any]() uintptr {
    20  //	type S struct {
    21  //		a T
    22  //		b T
    23  //	}
    24  //	var s S
    25  //	return unsafe.Offsetof(s.b)
    26  //}
    27  

View as plain text