Skip to content

Compiler allows '...' in func result params #423

@gopherbot

Description

@gopherbot

by befelemepeseveze:

What steps will reproduce the problem?
1.
$ cat > tmp.go <<EOF
> package main
> 
> import "fmt"
> 
> func tuple(args...) (...) { return args }
> 
> func main() {
>         a := tuple(1, "abc", 3.14)
>         fmt.Printf("%v %v %v\n", a)
> }
> EOF
$ 6g tmp.go && 6l tmp.6 && ./6.out
1 abc 3.14
$ 

What is the expected output? What do you see instead?
expected:
tmp.go:5:22: expected type, found '...'
instead: 
1 abc 3.14

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

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

Please provide any additional information below.
Current gofmt already properly rejects the above code regardless of the
-oldparser setting with a correct error message:
tmp.go:5:22: expected type, found '...'

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