This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gccgo] Permit return type to be func not inside parentheses


Before the semicolon change, a return type of func at top level has to
be inside parentheses.  That is no longer necessary, and I committed
this patch to the gccgo branch to permit it.

Ian

diff -r 830491507265 go/parse.cc
--- a/go/parse.cc	Mon Feb 01 23:12:41 2010 -0800
+++ b/go/parse.cc	Mon Feb 01 23:21:42 2010 -0800
@@ -633,13 +633,9 @@
   bool is_varargs = false;
   Typed_identifier_list* params = this->parameters(&is_varargs);
 
-  // At the top level, "func fn () func()" is two func declarations,
-  // not a single one returning a function type.
   Typed_identifier_list* result = NULL;
   if (this->peek_token()->is_op(OPERATOR_LPAREN)
-      || (this->type_may_start_here()
-	  && (!this->gogo_->in_global_scope()
-	      || !this->peek_token()->is_keyword(KEYWORD_FUNC))))
+      || this->type_may_start_here())
     result = this->result();
 
   Function_type* ret = Type::make_function_type(receiver, params, result,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]