Open
Description
Example:
package main
import (
"fmt"
"reflect"
)
type strPtr *string
func main() {
var s string = "abc"
var s1 *string = &s
var s2 strPtr = &s
fmt.Println(reflect.TypeOf(s1), reflect.TypeOf(s2))
v := struct {
s1 *string
s2 strPtr
}{
s1: &s,
s2: &s,
}
fmt.Println(reflect.TypeOf(v.s1), reflect.TypeOf(v.s2))
}
Expected output:
*string main.strPtr
*string main.strPtr
Actual output:
*string main.strPtr
*string *string
Proximate cause:
Composite literal compilation calls fc.translateImplicitConversionWithCloning()
(example), which handles pointer type conversion as a no-op, which is probably incorrect.