diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2015-08-11 21:37:26 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2015-08-11 21:37:26 +0000 |
commit | 2abb463fab4416e0d5365f6b846a725d525c08f1 (patch) | |
tree | db8965ca40a49640db9bae4de8f863d23dd4d37e /gcc | |
parent | d2be285bf53e470cc9038ce1c59661428143b277 (diff) | |
download | gcc-2abb463fab4416e0d5365f6b846a725d525c08f1.zip gcc-2abb463fab4416e0d5365f6b846a725d525c08f1.tar.gz gcc-2abb463fab4416e0d5365f6b846a725d525c08f1.tar.bz2 |
compiler: Don't make void-typed temporaries.
Fixes golang/go#11568.
Reviewed-on: https://go-review.googlesource.com/12653
From-SVN: r226788
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/go/gofrontend/MERGE | 2 | ||||
-rw-r--r-- | gcc/go/gofrontend/statements.cc | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index a5b77a4..2696ea5 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -5891a4c0615f469edcefc6d7a85a88984ba940aa +3bd90ea170b9c9aecedd37796acdd2712b29922b 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/statements.cc b/gcc/go/gofrontend/statements.cc index 96c142c..40b4373 100644 --- a/gcc/go/gofrontend/statements.cc +++ b/gcc/go/gofrontend/statements.cc @@ -348,7 +348,15 @@ Statement::make_variable_declaration(Named_object* var) Type* Temporary_statement::type() const { - return this->type_ != NULL ? this->type_ : this->init_->type(); + Type* type = this->type_ != NULL ? this->type_ : this->init_->type(); + + // Temporary variables cannot have a void type. + if (type->is_void_type()) + { + go_assert(saw_errors()); + return Type::make_error_type(); + } + return type; } // Traversal. |