golang/go

gccgo: allows to refer to builtin function not in call expression

dvyukov opened this issue · 2 comments

gccgo successfully compiles the following program:

package p
func _() {
    f := complex
    _ = f
}

while gc and go/types say:

go.go:3:9: error: invalid use of special builtin function ‘complex’; must be called
go.go:3: use of builtin complex not in function call

The spec says:

The built-in functions do not have standard Go types, so they can only appear in call expressions; they cannot be used as function values.

http://golang.org/ref/spec#Built-in_functions

gcc version 6.0.0 2015070 (experimental) (GCC)

CL https://golang.org/cl/12543 mentions this issue.