Skip to content

cmd/gc: spurious "use of untyped nil" errors '[]arr X nil' and 'uintptr X nil' operations #7206

@gopherbot

Description

@gopherbot

by carlchatfielduntrusted:

The below two lines will produce "use of untyped nil" errors in addition
to the usual nil conversion error
    _ = nil == uintptr(0)
    _ = nil == [1]int{}
Doesn't happen for other types

What steps will reproduce the problem?
package main

func main() {
    _ = nil == uintptr(0)
    _ = nil == [1]int{}
}
http://play.golang.org/p/EPqVqajWRv

What is the expected output?
prog.go:6: cannot convert nil to type uintptr
prog.go:7: cannot convert nil to type [1]int

What do you see instead?
prog.go:6: cannot convert nil to type uintptr
prog.go:6: use of untyped nil
prog.go:7: cannot convert nil to type [1]int
prog.go:7: use of untyped nil

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g/8g

Which operating system are you using?
linux

Which version are you using?  (run 'go version')
1.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions