modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/testdata/errchk/test/fixedbugs/bug477.go (about) 1 // compile 2 3 // Copyright 2013 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 // Test multiple identical unnamed structs with methods. This caused 8 // a compilation error with gccgo. 9 10 package p 11 12 type S1 struct{} 13 14 func (s S1) M() {} 15 16 type S2 struct { 17 F1 struct { 18 S1 19 } 20 F2 struct { 21 S1 22 } 23 } 24 25 type I interface { 26 M() 27 } 28 29 func F() { 30 var s2 S2 31 var i1 I = s2.F1 32 var i2 I = s2.F2 33 _, _ = i1, i2 34 }