Join GitHub today
cmd/compile: unsafe.Pointer not treated as a pointer for embedding #6357
http://play.golang.org/p/YhdG1ZoVzp Per the spec: "An embedded type must be specified as a type name T or as a pointer to a non-interface type name *T, and T itself may not be a pointer type." ( http://tip.golang.org/ref/spec#Struct_types ) gc issues an error for line 9 (as expected), but not for line 10. Arguably, an unsafe.Pointer is a pointer and thus line 10 should not be legal. The spec is not very clear about whether an unsafe.Pointer should act like a pointer in these situations, but: 1. The documentation (by pseudo code) defines unsafe.Pointer as *ArbitraryType ( http://tip.golang.org/ref/spec#Package_unsafe ) 2. For the purposes of method receivers, they are treated as pointers (see issue #6116) 3. It's ok to assign nil to it (see line 15 of the above code). 4. It's called a "Pointer".