Skip to content

cmd/compile: internal compiler error: expression has untyped type:  #55297

@AemonSwift

Description

@AemonSwift

internal compiler error: expression has untyped type:

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

$ go version
go version go1.19.1 darwin/arm64

Does this issue reproduce with the latest release?

yes

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

go env Output
$ go env
GO111MODULE="on"
GOARCH="arm64"
GOBIN=""
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOOS="darwin"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.google.cn"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.19.1"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
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/jw/zvq1_tb50_93d6qdvcm_2jph0000gn/T/go-build1146727949=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

func test[T string,R bool](a,b T ) R {
	return a>b
}
func main() {
        test[string,bool]("test1","test2")
}

What did you expect to see?

no compiler error

What did you see instead?

internal compiler error: expression has untyped type:
. GT untyped bool tc(1)
. . CALLFUNC Walked int tc(1)
. . . NAME-runtime.cmpstring Class:PFUNC Offset:0 Used FUNC-func(string, string) int tc(1)
. . CALLFUNC-Args
. . . NAME-main.a esc(no) Class:PPARAM DictIndex:1 Offset:0 OnStack Used go.shape.string_0 tc(1)
. . . NAME-main.b esc(no) Class:PPARAM DictIndex:1 Offset:0 OnStack Used go.shape.string_0 tc(1)
. . LITERAL-0 int tc(1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions