Skip to content

recursive type on pointer just hangs the compiler #48930

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nslaughter opened this issue Oct 12, 2021 · 2 comments
Closed

recursive type on pointer just hangs the compiler #48930

nslaughter opened this issue Oct 12, 2021 · 2 comments

Comments

@nslaughter
Copy link

nslaughter commented Oct 12, 2021

What version of Go are you using (go version)?

$ go version = 1.18 

Does this issue reproduce with the latest release?

I got this yesterday on my Macbook ARM64 with commit ef2ebbef9.
I got this result today on my Macbook AMD64 with commit 732f6fa9d5 (so just pulled latest a couple minutes ago).

What operating system and processor architecture are you using (go env)?

go env Output
GO111MODULE="on"
GOARCH="arm64"
GOBIN="/Users/njs/go/bin"
GOCACHE="/Users/njs/Library/Caches/go-build"
GOENV="/Users/njs/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/njs/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/njs/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/njs/go/src/github.com/golang/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/njs/go/src/github.com/golang/go/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="devel go1.18-ef2ebbebf9 Thu Oct 7 20:37:43 2021 +0000"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/njs/go/src/github.com/nslaughter/go-monads/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/74/dx3h3hvd45gbgzbmsmr05ld00000gn/T/go-build1884870266=/tmp/go-build -gno-record-gcc-switches -fno-common"

I can update with the output on amd64 as well if it will help.

What did you do?

I ran this in a file called main.go:

package main

type M[T any] struct {
	p M[*T]
}

What did you expect to see?

Something like ... main.go:ln:pos: invalid recursive type M which is what I see when T isn't a pointer.


It's at https://go2goplay.golang.org/p/mz9YHPAtvAW, which I think is useful because the playground handles the situation sensibly and would be in line with my expectations.

### What did you see instead?

`go run <file>.go` just hangs. And trying to `go build` a package with this file hangs also.
@ALTree
Copy link
Member

ALTree commented Oct 13, 2021

Tracked in #48098, #48018, and #48711 I think?

See #48098 (comment).

@toothrot
Copy link
Contributor

Closing as a duplicate as it appears to be covered by the issues linked above. Please let me know if I am mistaken.

@golang golang locked and limited conversation to collaborators Oct 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants