I don't get why the following code snippet isn't compiling. The compiler states:
cannot take the address of getAString()
The code:
func getAStringPointer() *string {
return &getAString()
}
func getAString() string {
return ""
}
But, storing the results of the function in auxliary variable and return the address of that variable the compiler behaves OK.
func getAStringPointer() *string {
var aString = getAString()
return &aString
}
func getAString() string {
return ""
}