Debian Codegraph @

gcc/testsuite/go.test/test/fixedbugs/issue15439.go

raw
1 // run
2
3 // Copyright 2016 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 package main
8
9 import "reflect"
10
11 func main() {
12 a := &struct{ x int }{}
13 b := &struct{ x int "" }{}
14
15 ta := reflect.TypeOf(a)
16 tb := reflect.TypeOf(b)
17
18 // Ensure cmd/compile treats absent and empty tags as equivalent.
19 a = b
20
21 // Ensure package reflect treats absent and empty tags as equivalent.
22 if !tb.AssignableTo(ta) {
23 panic("fail")
24 }
25 }