go issue53137 源码

  • 2022-07-15
  • 浏览 (586)

golang issue53137 代码


// run

// Copyright 2022 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (

type Embedded struct {
	B int

type S[K any] struct {
	A K

func showOffsets[K any](d *S[K]) {
	o1 := unsafe.Offsetof(d.B)
	o2 := unsafe.Offsetof(d.Embedded)
	if o1 != o2 {
		panic("offset mismatch")

func main() {


go 源码目录


go bug000 源码

go bug002 源码

go bug003 源码

go bug004 源码

go bug005 源码

go bug006 源码

go bug007 源码

go bug008 源码

go bug009 源码

go bug010 源码

0  赞