Skip to content

cmd/compile: send statements cannot be parenthesized #6791

@griesemer

Description

@griesemer
The following program

http://play.golang.org/p/JAKJ9WVL00

is accepted w/o compilation error. However, a send statement is a regular statement and
cannot be parenthesized. This is probably an artifact from the time when sends were
expressions.

gccgo reports an error:

$ cat x.go
package main

func main() {
     var ch chan int
     (ch<-0)
}

$ gccgo x.go
x.go:5:9: error: missing ')'
      (ch<-0)
         ^
x.go:5:12: error: expected ';' or '}' or newline
      (ch<-0)
            ^

And so does gotype:

$ gotype x.go
x.go:5:5: expected ')', found '<-'
x.go:6:2: expected '}', found 'EOF'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions