Go patch committed: Accept comma after expression in type conversion

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

Commit Message

Ian Taylor Dec. 5, 2012, 1:09 a.m.
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.



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 @@ 
 	  Expression* expr = this->expression(PRECEDENCE_NORMAL, false, true,
+	  if (this->peek_token()->is_op(OPERATOR_COMMA))
+	    this->advance_token();
 	  if (this->peek_token()->is_op(OPERATOR_ELLIPSIS))