Closed
Description
What version of Go are you using (go version
)?
go version go1.11 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.11/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.11/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/02/nfvdwz45077g85khfsv07khm0000gn/T/go-build787448559=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
https://play.golang.org/p/SMcx3vUC83W
Compile this code with Go 1.11 and Go 1.10.3 respectively.
What did you expect to see?
Code compiles without any error with both Go 1.11 and Go 1.10.3.
What did you see instead?
Go 1.11 failed to compile this code with the following error:
On my machine:
❯ go build recur.go
# command-line-arguments
./recur.go:10:6: invalid recursive type Executor
./recur.go:16:29: cannot use callback (type func(*Executor) error) as type Executor in field value
./recur.go:21:19: cannot call non-function e.callback (type Executor)
Go 1.10.3 succeeded without any issue.
Metadata
Metadata
Assignees
Labels
Type
Projects
Relationships
Development
No branches or pull requests
Activity
agnivade commentedon Aug 27, 2018
Likely a duplicate of #27232.
/cc @josharian @mdempsky
[-]Simple code containing recursive type definition failed to compile under Go 1.11[/-][+]cmd/compile: invalid recursive type[/+]josharian commentedon Aug 27, 2018
Indeed.
This and #27232 are more in the domain of @mdempsky or @griesemer than me. (And I also don't have much time at the moment, and these seem like important fixes that could use a prompt backport.)
FiloSottile commentedon Aug 30, 2018
(If this turns out NOT to be a duplicate of #27232, please open a separate backport issue.)
griesemer commentedon Sep 5, 2018
Simpler reproducer, with irrelevant details stripped:
This looks very much like a duplicate of #27232, though with different details. Leaving open until we know more.
griesemer commentedon Oct 29, 2018
Simpler reproducer:
The problem appears to be an incorrectly built type data structure for S after type-checking, such that the type of S.p is S rather than *S. The consequence is the error when calling checkwidth.
griesemer commentedon Oct 31, 2018
Probably a duplicate of #25838. Leaving open for now.
gopherbot commentedon Nov 3, 2018
Change https://golang.org/cl/147286 mentions this issue:
cmd/compile: reintroduce work-around for cyclic alias declarations
gopherbot commentedon Nov 26, 2018
Change https://golang.org/cl/151339 mentions this issue:
[release-branch.go1.11] cmd/compile: reintroduce work-around for cyclic alias declarations
[release-branch.go1.11] cmd/compile: reintroduce work-around for cycl…
go1.11.2 updates tracking (#2)