diff --git a/_test/composite11.go b/_test/composite11.go new file mode 100644 index 000000000..85f710182 --- /dev/null +++ b/_test/composite11.go @@ -0,0 +1,15 @@ +package main + +import ( + "fmt" + "image/color" +) + +func main() { + c := color.NRGBA64{1, 1, 1, 1} + + fmt.Println(c) +} + +// Output: +// {1 1 1 1} diff --git a/interp/run.go b/interp/run.go index b70afa92b..a85206d8a 100644 --- a/interp/run.go +++ b/interp/run.go @@ -2011,10 +2011,11 @@ func compositeBinStruct(n *node) { } } else { fieldIndex[i] = []int{i} - convertLiteralValue(c.child[1], typ.Field(i).Type) if c.typ.cat == funcT { + convertLiteralValue(c.child[1], typ.Field(i).Type) values[i] = genFunctionWrapper(c.child[1]) } else { + convertLiteralValue(c, typ.Field(i).Type) values[i] = genValue(c) } }