diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2010-12-21 18:20:51 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2010-12-21 18:20:51 +0000 |
commit | 3cddc98026935f84fc71d5e6437bf9e87712898f (patch) | |
tree | df968937cbc62370baaa8a8bb6cc93d32390b251 | |
parent | 8cd15b1036b59d3b29c392db701d7a8625b2d1e2 (diff) | |
download | gcc-3cddc98026935f84fc71d5e6437bf9e87712898f.zip gcc-3cddc98026935f84fc71d5e6437bf9e87712898f.tar.gz gcc-3cddc98026935f84fc71d5e6437bf9e87712898f.tar.bz2 |
Don't crash when some object is redefined as a type.
From-SVN: r168126
-rw-r--r-- | gcc/go/gofrontend/gogo.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc index 8ba1d4f..d5db85c 100644 --- a/gcc/go/gofrontend/gogo.cc +++ b/gcc/go/gofrontend/gogo.cc @@ -881,7 +881,7 @@ Gogo::add_type(const std::string& name, Type* type, source_location location) { Named_object* no = this->current_bindings()->add_type(name, NULL, type, location); - if (!this->in_global_scope()) + if (!this->in_global_scope() && no->is_type()) no->type_value()->set_in_function(this->functions_.back().function); } @@ -901,7 +901,7 @@ Gogo::declare_type(const std::string& name, source_location location) { Bindings* bindings = this->current_bindings(); Named_object* no = bindings->add_type_declaration(name, NULL, location); - if (!this->in_global_scope()) + if (!this->in_global_scope() && no->is_type_declaration()) { Named_object* f = this->functions_.back().function; no->type_declaration_value()->set_in_function(f); |