This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Go patch committed: Fix invalid signature in function literal
- From: Ian Lance Taylor <iant at google dot com>
- To: gcc-patches at gcc dot gnu dot org, gofrontend-dev at googlegroups dot com
- Date: Wed, 15 Dec 2010 14:42:33 -0800
- Subject: Go patch committed: Fix invalid signature in function literal
This patch to the Go frontend fixes the way we handle an invalid
signature for a function literal. Rather than trying to parse the block
without creating a function, which fails if there is a return statement,
we instead just create a dummy function type. Bootstrapped and ran Go
testsuite on x86_64-unknown-linux-gnu. Committed to mainline.
Ian
diff -r 70dbc32f9149 go/parse.cc
--- a/go/parse.cc Wed Dec 15 14:30:06 2010 -0800
+++ b/go/parse.cc Wed Dec 15 14:38:25 2010 -0800
@@ -2513,10 +2513,7 @@
Function_type* type = this->signature(NULL, location);
if (type == NULL)
- {
- this->block();
- return Expression::make_error(location);
- }
+ type = Type::make_function_type(NULL, NULL, NULL, location);
// For a function literal, the next token must be a '{'. If we
// don't see that, then we may have a type expression.