repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
PR inline-asm/84742
[official-gcc.git]
/
gcc
/
testsuite
/
go.go-torture
/
execute
/
printnil.go
blob
9b72dd4736455002346df386d464ff04388ffe3e
1
// printnil checks that fmt correctly handles a nil pointer receiver
2
// for a value method at all optimization levels.
3
package
main
4
5
import
"fmt"
6
7
type
MyType
struct
{
8
val
int
9
}
10
11
func
(
t MyType
)
String
()
string
{
12
return
"foobar"
13
}
14
15
func
main
() {
16
if
got
:=
fmt
.
Sprintf
(
"
%s
"
, (*
MyType
)(
nil
));
got
!=
"<nil>"
{
17
panic
(
got
)
18
}
19
}