The Go language accepts an optional comma after an expression in a type
conversion.  This is because type conversions can look like function
calls.  The Go frontend was incorrectly rejecting these valid programs.
This patch fixes that.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline and 4.7 branch.

Ian

diff -r 76d51e7d9209 go/parse.cc
--- a/go/parse.cc	Tue Dec 04 16:52:53 2012 -0800
+++ b/go/parse.cc	Tue Dec 04 17:04:39 2012 -0800
@@ -2979,6 +2979,8 @@
 	  this->advance_token();
 	  Expression* expr = this->expression(PRECEDENCE_NORMAL, false, true,
 					      NULL);
+	  if (this->peek_token()->is_op(OPERATOR_COMMA))
+	    this->advance_token();
 	  if (this->peek_token()->is_op(OPERATOR_ELLIPSIS))
 	    {
 	      error_at(this->location(),

Reply via email to