Go patch committed: Fix type of discarded send expression

Submitted by Ian Taylor on March 3, 2011, 1:17 a.m.

Details

Message ID mcripw13suk.fsf@google.com
State New
Headers show

Commit Message

Ian Taylor March 3, 2011, 1:17 a.m.
This patch to the Go frontend fixes the type of a discarded send
expression.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

Patch hide | download patch | download mbox

diff -r 4e92162e8594 go/expressions.cc
--- a/go/expressions.cc	Wed Mar 02 16:53:50 2011 -0800
+++ b/go/expressions.cc	Wed Mar 02 17:09:04 2011 -0800
@@ -12321,7 +12321,10 @@ 
 Type*
 Send_expression::do_type()
 {
-  return Type::lookup_bool_type();
+  if (this->is_value_discarded_)
+    return Type::make_void_type();
+  else
+    return Type::lookup_bool_type();
 }
 
 // Set types.