Skip to content

go/types: string(1 << s) should be an error #26096

@griesemer

Description

@griesemer
package main

func main() {
	var s uint
	_ = string(1 << s)
}

(https://play.golang.org/p/owHsmdZd32v) is an error: The 1 in 1 << s assumes the type it would have without the shift, which is string. Both cm/compile and gccgo correct report an error.

go/types appears to accept it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions