We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
This works:
$ cat b.go package b type T struct { } func F() []*T { return []*T{&T{}} } $ cat a.go package a import "./b" func F() { b.F() } $ go tool compile b.go && go tool compile a.go
This does not (dropped the unnecessary &T in the inner composite literal):
&T
$ cat b.go package b type T struct { } func F() []*T { return []*T{{}} } $ go tool compile b.go && go tool compile a.go panic: runtime error: invalid memory address or nil pointer dereference [signal 0xb code=0x1 addr=0x30 pc=0x2277f0] goroutine 1 [running]: bootstrap/compile/internal/gc.typecheck1(0xc2083bc120, 0x44, 0x4) /Users/rsc/go/src/cmd/compile/internal/gc/typecheck.go:478 +0xa5e0 bootstrap/compile/internal/gc.typecheck(0xc2083bc120, 0x44, 0xc2083bc090) /Users/rsc/go/src/cmd/compile/internal/gc/typecheck.go:188 +0x8d7 bootstrap/compile/internal/gc.typecheckcomplit(0xc2083bc090, 0x0) /Users/rsc/go/src/cmd/compile/internal/gc/typecheck.go:2847 +0x1dd bootstrap/compile/internal/gc.typecheck1(0xc2083bc090, 0x2, 0x3) /Users/rsc/go/src/cmd/compile/internal/gc/typecheck.go:823 +0x6924 bootstrap/compile/internal/gc.typecheck(0xc2083bc090, 0x2, 0xc2083bc000) /Users/rsc/go/src/cmd/compile/internal/gc/typecheck.go:188 +0x8d7 bootstrap/compile/internal/gc.typecheckcomplit(0xc2083afdd0, 0x0) /Users/rsc/go/src/cmd/compile/internal/gc/typecheck.go:2928 +0xac0 bootstrap/compile/internal/gc.typecheck1(0xc2083afdd0, 0x12, 0x2) /Users/rsc/go/src/cmd/compile/internal/gc/typecheck.go:823 +0x6924 bootstrap/compile/internal/gc.typecheck(0xc2083afdd0, 0x12, 0xc20802cb28) /Users/rsc/go/src/cmd/compile/internal/gc/typecheck.go:188 +0x8d7 bootstrap/compile/internal/gc.typecheckslice(0xc20804c708, 0x1, 0x1, 0x12) /Users/rsc/go/src/cmd/compile/internal/gc/typecheck.go:49 +0x63 bootstrap/compile/internal/gc.typecheck1(0xc2083afd40, 0x1, 0x1) /Users/rsc/go/src/cmd/compile/internal/gc/typecheck.go:2028 +0x10d0f bootstrap/compile/internal/gc.typecheck(0xc2083afd40, 0x1, 0xccff) /Users/rsc/go/src/cmd/compile/internal/gc/typecheck.go:188 +0x8d7 bootstrap/compile/internal/gc.typecheckslice(0xc20804c710, 0x1, 0x1, 0x1) /Users/rsc/go/src/cmd/compile/internal/gc/typecheck.go:49 +0x63 bootstrap/compile/internal/gc.typecheckinl(0xc2083afcb0) /Users/rsc/go/src/cmd/compile/internal/gc/inl.go:78 +0x134 bootstrap/compile/internal/gc.mkinlcall1(0xc2083bc6c0, 0xc2083afcb0, 0x1ea400, 0xc2083b4930) /Users/rsc/go/src/cmd/compile/internal/gc/inl.go:536 +0xb6 bootstrap/compile/internal/gc.mkinlcall(0xc2083bc6c0, 0xc2083afcb0, 0x0, 0x0) /Users/rsc/go/src/cmd/compile/internal/gc/inl.go:501 +0x73 bootstrap/compile/internal/gc.inlnode(0xc2083bc6c0, 0xc20804c750) /Users/rsc/go/src/cmd/compile/internal/gc/inl.go:461 +0x85c bootstrap/compile/internal/gc.inlnodelist(0xc208399cc0) /Users/rsc/go/src/cmd/compile/internal/gc/inl.go:319 +0x85 bootstrap/compile/internal/gc.inlnode(0xc2083bc360, 0xc2083bc360) /Users/rsc/go/src/cmd/compile/internal/gc/inl.go:437 +0x551 bootstrap/compile/internal/gc.inlcalls(0xc2083bc360) /Users/rsc/go/src/cmd/compile/internal/gc/inl.go:275 +0x4e bootstrap/compile/internal/gc.func·019(0xc20804c748, 0x1, 0x1, 0xc2083c1a00) /Users/rsc/go/src/cmd/compile/internal/gc/main.go:433 +0x7b bootstrap/compile/internal/gc.(*bottomUpVisitor).visit(0xc2083b2c60, 0xc2083bc360, 0xc2083b2c90) /Users/rsc/go/src/cmd/compile/internal/gc/esc.go:106 +0x3a5 bootstrap/compile/internal/gc.visitBottomUp(0xc20804c740, 0x1, 0x1, 0x676728) /Users/rsc/go/src/cmd/compile/internal/gc/esc.go:62 +0xe4 bootstrap/compile/internal/gc.Main() /Users/rsc/go/src/cmd/compile/internal/gc/main.go:436 +0x25cb bootstrap/compile/internal/amd64.Main() /Users/rsc/go/src/cmd/compile/internal/amd64/galign.go:96 +0x7bc main.main() /Users/rsc/go/src/cmd/compile/main.go:33 +0x17b goroutine 2 [runnable]: runtime.forcegchelper() /Users/rsc/go1.4/src/runtime/proc.go:90 runtime.goexit() /Users/rsc/go1.4/src/runtime/asm_amd64.s:2232 +0x1 goroutine 3 [runnable]: runtime.bgsweep() /Users/rsc/go1.4/src/runtime/mgc0.go:82 runtime.goexit() /Users/rsc/go1.4/src/runtime/asm_amd64.s:2232 +0x1 goroutine 4 [runnable]: runtime.runfinq() /Users/rsc/go1.4/src/runtime/malloc.go:712 runtime.goexit() /Users/rsc/go1.4/src/runtime/asm_amd64.s:2232 +0x1 $
The text was updated successfully, but these errors were encountered:
exporter.expr (bexport.go) is missing
if n.Op != OLITERAL && n.Orig != nil { n = n.Orig }
and never sees a OCOMPLIT. Need to determine what's the best way to handle this.
Sorry, something went wrong.
CL https://golang.org/cl/22935 mentions this issue.
87a2ae1
No branches or pull requests
This works:
This does not (dropped the unnecessary
&T
in the inner composite literal):The text was updated successfully, but these errors were encountered: