Skip to content

gc: implement new comparison typechecking #1070

@gjemiller

Description

@gjemiller
Before filing a bug, please check whether it has been fixed since
the latest release: run "hg pull -u" and retry what you did to
reproduce the problem.  Thanks.

What steps will reproduce the problem?
1. '6g funcequal.go' (attached)
2.
3.

What is the expected output?
Compiles without error

What do you see instead?
funcequal.go:16: invalid operation: doCompare == foo (type func(v1 int, v2 int) int ==
CompareFunc)

What is your $GOOS?  $GOARCH?
linux, amd64

Which revision are you using?  (hg identify)
d558ddfffe1d+ tip

Please provide any additional information below.
The function pointer for doCompare is assigned to a variable which silently converts it
to the compatible type, CompareFunc.  That variable is then compared with the original
pointer, which seems like it should be possible, given the previous assignment. The
compiler errors out because the two function pointers are of different types.

Attachments:

  1. funcequal.go (319 bytes)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions