Patchwork Go patch committed: Fix type of discarded send expression

login
register
mail settings
Submitter Ian Taylor
Date March 3, 2011, 1:17 a.m.
Message ID <mcripw13suk.fsf@google.com>
Download mbox | patch
Permalink /patch/85207/
State New
Headers show

Comments

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

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.