compiler: fix check for pointer in Temporary_reference_expression
The check for an unrepresentable pointer in
Temporary_reference_expression::do_get_backend was incorrectly
translated from C to Go in https://golang.org/cl/14346043. Fix the
check to use points_to rather than has_pointer and deref. This should
not make any difference in practice as either way the condition will
only be true for a pointer to void, but points_to is correct and more
efficient.
Change-Id: Iaeec7541a74b75a92991670f403ff13c20211afa
Reviewed-on: https://go-review.googlesource.com/38009
Reviewed-by: Than McIntosh <thanm@google.com>
diff --git a/go/expressions.cc b/go/expressions.cc
index 7db2929..5926434 100644
--- a/go/expressions.cc
+++ b/go/expressions.cc
@@ -900,8 +900,8 @@
// the circularity down one level.
Type* stype = this->statement_->type();
if (!this->is_lvalue_
- && stype->has_pointer()
- && stype->deref()->is_void_type())
+ && stype->points_to() != NULL
+ && stype->points_to()->is_void_type())
{
Btype* btype = this->type()->base()->get_backend(gogo);
ret = gogo->backend()->convert_expression(btype, ret, this->location());