Source file test/fixedbugs/issue33062.go

     1  // run
     2  
     3  // Copyright 2019 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 33062: gccgo generates incorrect type equality
     8  // functions.
     9  
    10  package main
    11  
    12  type simpleStruct struct {
    13  	int
    14  	string
    15  }
    16  
    17  type complexStruct struct {
    18  	int
    19  	simpleStruct
    20  }
    21  
    22  func main() {
    23  	x := complexStruct{1, simpleStruct{2, "xxx"}}
    24  	ix := interface{}(x)
    25  	y := complexStruct{1, simpleStruct{2, "yyy"}}
    26  	iy := interface{}(y)
    27  	if ix != ix {
    28  		panic("FAIL")
    29  	}
    30  	if ix == iy {
    31  		panic("FAIL")
    32  	}
    33  }
    34  

View as plain text