test: add new Go tests from source repo
[official-gcc.git] / gcc / testsuite / go.test / test / fixedbugs / issue11790.go
blob096b297f990d02a08997b180fa5fafe15860b6ad
1 // compile
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.
7 // Issue 11790: Incorrect error following named pointer dereference on field
9 package main
11 import "fmt"
13 type T0 struct {
14 x int
17 func (*T0) M0() {
18 fmt.Println("M0")
21 type T2 struct {
22 *T0
25 type Q *T2
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()