public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <iant@golang.org>
To: gcc-patches <gcc-patches@gcc.gnu.org>,
		"gofrontend-dev@googlegroups.com"
	<gofrontend-dev@googlegroups.com>
Subject: Go patch committed: build pointer type to types with methods
Date: Sat, 31 Oct 2015 01:00:00 -0000	[thread overview]
Message-ID: <CAOyqgcUcPsf_d8i2cjn47jt_mEx8xeKbXw9c9epgMeY+QS6sEA@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 352 bytes --]

The Go compiler always builds the pointer type for any named type, so
that it can attach methods in case the program calls reflect.PtrTo.
However, it didn't do that for unnamed types that happened to have
methods due to inheritance.  This patch fixes that problem.
Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.  Committed
to mainline.

Ian

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1103 bytes --]

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 229546)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@
-85994dd0a88d1b24b2ddfc9c9ab22ee16c9e8b54
+16f69a4007a1903da4055a496882b514e05f45f3
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: gcc/go/gofrontend/types.cc
===================================================================
--- gcc/go/gofrontend/types.cc	(revision 229546)
+++ gcc/go/gofrontend/types.cc	(working copy)
@@ -2064,11 +2064,15 @@ Type::type_descriptor_constructor(Gogo*
 
   ++p;
   go_assert(p->is_field_name("ptrToThis"));
-  if (name == NULL)
+  if (name == NULL && methods == NULL)
     vals->push_back(Expression::make_nil(bloc));
   else
     {
-      Type* pt = Type::make_pointer_type(name);
+      Type* pt;
+      if (name != NULL)
+	pt = Type::make_pointer_type(name);
+      else
+	pt = Type::make_pointer_type(this);
       vals->push_back(Expression::make_type_descriptor(pt, bloc));
     }
 

                 reply	other threads:[~2015-10-30 23:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOyqgcUcPsf_d8i2cjn47jt_mEx8xeKbXw9c9epgMeY+QS6sEA@mail.gmail.com \
    --to=iant@golang.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gofrontend-dev@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).