The Go spec's grammar restricts method expressions to using either a named type or pointer to a named type:
MethodExpr = ReceiverType "." MethodName .
ReceiverType = TypeName | "(" "*" TypeName ")" | "(" ReceiverType ")" .
cmd/compile erroneously accepts this Go source:
package p
var _ = struct{ error }.Error
go/types erroneously accepts it too.
gccgo correctly rejects with the error message "method expression requires named type or pointer to named type"
/cc @griesemer @ianlancetaylor
The Go spec's grammar restricts method expressions to using either a named type or pointer to a named type:
cmd/compile erroneously accepts this Go source:
go/types erroneously accepts it too.
gccgo correctly rejects with the error message "method expression requires named type or pointer to named type"
/cc @griesemer @ianlancetaylor