compiler: avoid crash on real declaration of type with existing method

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
This commit is contained in:
Ian Lance Taylor 2019-04-29 18:56:24 +00:00
parent 1978e62d47
commit 65937ccf0b
2 changed files with 3 additions and 2 deletions

View 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.

View 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);
}
}