summaryrefslogtreecommitdiff
path: root/libgo
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-10 20:24:04 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-10 20:24:04 +0000
commitbe67917e9b3c48c4ee28313d7e1407399603f968 (patch)
treeb45bfcd5c4f1c71a53db07760f3f546be38c1435 /libgo
parent38a68dc27c770210e3cc6afe6de50b99550e6402 (diff)
downloadgcc-be67917e9b3c48c4ee28313d7e1407399603f968.tar.gz
reflect: Fix bug comparing struct field types.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193395 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo')
-rw-r--r--libgo/go/reflect/type.go17
1 files changed, 14 insertions, 3 deletions
diff --git a/libgo/go/reflect/type.go b/libgo/go/reflect/type.go
index b5f27d0b446..60a958a24d7 100644
--- a/libgo/go/reflect/type.go
+++ b/libgo/go/reflect/type.go
@@ -363,7 +363,7 @@ type Method struct {
// PkgPath is the package path that qualifies a lower case (unexported)
// method name. It is empty for upper case (exported) method names.
// The combination of PkgPath and Name uniquely identifies a method
- // in a method set.
+ // in a method set.
// See http://golang.org/ref/spec#Uniqueness_of_identifiers
Name string
PkgPath string
@@ -1309,8 +1309,19 @@ func haveIdenticalUnderlyingType(T, V *commonType) bool {
for i := range t.fields {
tf := &t.fields[i]
vf := &v.fields[i]
- if tf.name != vf.name || tf.pkgPath != vf.pkgPath ||
- tf.typ != vf.typ || tf.tag != vf.tag || tf.offset != vf.offset {
+ if tf.name != vf.name && (tf.name == nil || vf.name == nil || *tf.name != *vf.name) {
+ return false
+ }
+ if tf.pkgPath != vf.pkgPath && (tf.pkgPath == nil || vf.pkgPath == nil || *tf.pkgPath != *vf.pkgPath) {
+ return false
+ }
+ if tf.typ != vf.typ {
+ return false
+ }
+ if tf.tag != vf.tag && (tf.tag == nil || vf.tag == nil || *tf.tag != *vf.tag) {
+ return false
+ }
+ if tf.offset != vf.offset {
return false
}
}