blob: 9b72dd4736455002346df386d464ff04388ffe3e [file] [log] [blame]
// printnil checks that fmt correctly handles a nil pointer receiver
// for a value method at all optimization levels.
package main
import "fmt"
type MyType struct {
val int
}
func (t MyType) String() string {
return "foobar"
}
func main() {
if got := fmt.Sprintf("%s", (*MyType)(nil)); got != "<nil>" {
panic(got)
}
}