The gofrontend parser had a bug that caused it to fail to parse a
select case like *v, *ok = <-c, in which the receivers of the channel
were expressions rather than identifiers.  This patch from Chris
Manghane fixes the problem.  This is GCC PR 61253.  Bootstrapped and
ran Go testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian
diff -r fbb82148b328 go/parse.cc
--- a/go/parse.cc       Sun Dec 14 11:37:40 2014 -0800
+++ b/go/parse.cc       Mon Dec 15 09:08:30 2014 -0800
@@ -5031,6 +5031,16 @@
       e = Expression::make_receive(*channel, (*channel)->location());
     }
 
+  if (!saw_comma && this->peek_token()->is_op(OPERATOR_COMMA))
+    {
+      this->advance_token();
+      // case v, e = <-c:
+      if (!e->is_sink_expression())
+       *val = e;
+      e = this->expression(PRECEDENCE_NORMAL, true, true, NULL, NULL);
+      saw_comma = true;
+    }
+
   if (this->peek_token()->is_op(OPERATOR_EQ))
     {
       if (!this->advance_token()->is_op(OPERATOR_CHANOP))

Reply via email to