modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/testdata/errchk/test/fixedbugs/issue22904.go (about)

     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 22904: Make sure the compiler emits a proper error message about
     8  // invalid recursive types rather than crashing.
     9  
    10  package p
    11  
    12  type a struct{ b }
    13  type b struct{ a } // ERROR "invalid recursive type"
    14  
    15  var x interface{}
    16  
    17  func f() {
    18  	x = a{}
    19  }