No.
package main
/*
#include <stdlib.h>
typedef struct Point {
int x;
int y;
} Point;
typedef struct Points {
Point* points;
int length;
} Points;
typedef struct Rect {
Points rts;
} Rect;
struct Rect X() {
struct Rect foo;
return foo;
}
void Y(Points ps) {
}
*/
import "C"
func main() {
foo := C.X()
defer C.Y(foo.rts)
}
# command-line-arguments
panic: Non-SSAable value should be a named location: foo.rts
goroutine 21 [running]:
cmd/compile/internal/gc.(*state).openDeferSave(0xc0002d2480, 0xc000319f00, 0xc00044ae40, 0xc0004988c0, 0xc000498700)
C:/dev/go/src/cmd/compile/internal/gc/ssa.go:4184 +0x7a1
cmd/compile/internal/gc.(*state).openDeferRecord(0xc0002d2480, 0xc000319e80)
C:/dev/go/src/cmd/compile/internal/gc/ssa.go:4130 +0x237
cmd/compile/internal/gc.(*state).stmt(0xc0002d2480, 0xc000319f80)
C:/dev/go/src/cmd/compile/internal/gc/ssa.go:1080 +0x16f8
cmd/compile/internal/gc.(*state).stmtList(0xc0002d2480, 0xc00031a7e0)
C:/dev/go/src/cmd/compile/internal/gc/ssa.go:1018 +0x5f
cmd/compile/internal/gc.buildssa(0xc0002b8dc0, 0x0, 0x0)
C:/dev/go/src/cmd/compile/internal/gc/ssa.go:426 +0xc40
cmd/compile/internal/gc.compileSSA(0xc0002b8dc0, 0x0)
C:/dev/go/src/cmd/compile/internal/gc/pgen.go:298 +0x64
cmd/compile/internal/gc.compileFunctions.func2(0xc000091500, 0xc00034ccb0, 0x0)
C:/dev/go/src/cmd/compile/internal/gc/pgen.go:363 +0x50
created by cmd/compile/internal/gc.compileFunctions
C:/dev/go/src/cmd/compile/internal/gc/pgen.go:361 +0x12f
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
No.
What operating system and processor architecture are you using (
go env)?go envOutputWhat did you do?
main.go
Compiling this code
What did you expect to see?
Success to compile
What did you see instead?