compiler: avoid crash on real declaration of type with existing method
authorIan Lance Taylor <ian@gcc.gnu.org>
Mon, 29 Apr 2019 18:56:24 +0000 (18:56 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Mon, 29 Apr 2019 18:56:24 +0000 (18:56 +0000)
    This avoids a compiler crash on invalid code.

    Fixes https://gcc.gnu.org/PR90272

    Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/174377

From-SVN: r270658

gcc/go/gofrontend/MERGE
gcc/go/gofrontend/gogo.cc

index 8af11d906a4f5e3f2adfa24723a09c0756e44409..0b4e3f186ad228c2544d53399f13c08edec87188 100644 (file)
@@ -1,4 +1,4 @@
-b117b468264665cfe6ec2cf3affb48330a704fa7
+9476f6183791477dd9b883f51e2a46b224227735
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
index 1efaadf8c9d0d79bc744b18cc0d0b8230991c74c..11bc7ddf6162fecaee3a32d954e0fddb6403e66f 100644 (file)
@@ -7816,7 +7816,8 @@ Type_declaration::define_methods(Named_type* nt)
        p != this->methods_.end();
        ++p)
     {
-      if (!(*p)->func_value()->is_sink())
+      if ((*p)->is_function_declaration()
+         || !(*p)->func_value()->is_sink())
        nt->add_existing_method(*p);
     }
 }