Skip to content

cmd/compile: struct interface{} value lost passing by value #30956

@benjaminp

Description

@benjaminp

What version of Go are you using (go version)?

$ go version
1.12.1

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

Linux amd64

What did you do?

Consider this program (https://play.golang.org/p/lblyBSvvbis):

package main

import "fmt"

type X struct {
	V interface{}

	a uint64
	b uint64
	c uint64
}

func pr(x X) {
	fmt.Println(x.V)
}

func main() {
	pr(X{
		V: struct {
			A int
		}{42},
	})
}

What did you expect to see?

{42} printed.

What did you see instead?

With Go 1.12.1, this program prints <nil>. With Go 1.11.6, it prints {42} as expected.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions