diff mbox series

Go patch committed: Permit unnamed types when ignoring struct tags

Message ID CAOyqgcX9iyBpTs+zm4EhosrwZG=C_UQVe6p_HSn1rKMp8TRyqA@mail.gmail.com
State New
Headers show
Series Go patch committed: Permit unnamed types when ignoring struct tags | expand

Commit Message

Ian Lance Taylor Jan. 6, 2022, 7:24 p.m. UTC
This patch to the Go frontend permits converting unnamed types when
ignoring struct tags.  I think the code was written this way because
before conversion could ignore struct tags this case could only arise
with named types.  Now that conversions permit struct tags to change,
this can occur with unnamed types as well.  The test case is
https://golang.org/cl/375796.  This fixes
https://golang.org/issue/50439.  Bootstrapped and ran Go testsuite on
x86_64-pc-linux-gnu.  Committed to mainline.

Ian
89ce08665e128d2f8e9ae148044134d9e94a9509
diff mbox series

Patch

diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index a18f3a37349..9cc6a1c63c6 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@ 
-9732b0766667b9235d0f35d0fb0abfe406b94d49
+799e9807c36fc661b14dfff136369556f09a5ebf
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc
index 57c02a97ef0..1c67ea099eb 100644
--- a/gcc/go/gofrontend/types.cc
+++ b/gcc/go/gofrontend/types.cc
@@ -791,8 +791,7 @@  Type::are_convertible(const Type* lhs, const Type* rhs, std::string* reason)
 
   // The types are convertible if they have identical underlying
   // types, ignoring struct field tags.
-  if ((lhs->named_type() != NULL || rhs->named_type() != NULL)
-      && Type::are_identical(lhs->base(), rhs->base(), 0, reason))
+  if (Type::are_identical(lhs->base(), rhs->base(), 0, reason))
     return true;
 
   // The types are convertible if they are both unnamed pointer types