Skip to content

gccgo: confusing error message when encountering invalid .. (dot dot) token #28128

Open
@griesemer

Description

@griesemer

For

$ cat y.go
package p

func f(x ..int) {}

current gccgo reports the errors:

$ gccgo -c y.go
y.go:3:10: error: expected package
3 | func f(x ..int) {}
  |          ^
y.go:3:8: error: invalid named/anonymous mix
3 | func f(x ..int) {}
  |        ^

I would have expected an error at the .. as it is not a valid token.

For the reference, cmd/compile reports for the same file:

$ go tool compile y.go
y.go:3:11: syntax error: unexpected ., expecting name

which seems more sensible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions