Merge from mainline (167278:168000).
[official-gcc/graphite-test-results.git] / gcc / testsuite / go.test / test / fixedbugs / bug117.go
blobad89ebf52a9b9108179bfce0ccf4de2bf2c3211f
1 // errchk $G $D/$F.go
3 // Copyright 2009 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
7 package main
9 type S struct {
10 a int
12 type PS *S
14 func (p *S) get() int {
15 return p.a
18 func fn(p PS) int {
19 // p has type PS, and PS has no methods.
20 // (a compiler might see that p is a pointer
21 // and go looking in S without noticing PS.)
22 return p.get() // ERROR "undefined"
24 func main() {
25 s := S{1}
26 if s.get() != 1 {
27 panic("fail")