Source file test/fixedbugs/issue21770.go

     1  // errorcheck
     2  
     3  // Copyright 2017 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 21770: gccgo incorrectly accepts "p.f = 0" where p is **struct
     8  
     9  package p
    10  
    11  type PP **struct{ f int }
    12  
    13  func f() {
    14  	// anonymous type
    15  	var p **struct{ f int }
    16  	p.f = 0 // ERROR "field"
    17  	// named type
    18  	var p2 PP
    19  	p2.f = 0 // ERROR "field"
    20  }
    21  

View as plain text