Debian Codegraph @

test/fixedbugs/issue11790.go

raw
1 // compile
2
3 // Copyright 2015 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.
6
7 // Issue 11790: Incorrect error following named pointer dereference on field
8
9 package main
10
11 import "fmt"
12
13 type T0 struct {
14 x int
15 }
16
17 func (*T0) M0() {
18 fmt.Println("M0")
19 }
20
21 type T2 struct {
22 *T0
23 }
24
25 type Q *T2
26
27 func main() {
28 // If run, expected output is
29 // 42
30 // M0
31 t0 := T0{42}
32 t2 := T2{&t0}
33 var q Q = &t2
34 fmt.Println(q.x) // Comment out either this line or the next line and the program works
35 (*q).T0.M0()
36 }