diff mbox

[gccgo] Permit omitting lower bound in a slice expression

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

Commit Message

Ian Lance Taylor Sept. 10, 2010, 11:19 p.m. UTC
The Go language was tweaked to permit omitting the lower bound in a
slice expression.  This patch implements that for gccgo.  Committed to
gccgo branch.

Ian
diff mbox

Patch

diff -r f46918ae9445 go/parse.cc
--- a/go/parse.cc	Fri Sep 10 11:41:29 2010 -0700
+++ b/go/parse.cc	Fri Sep 10 16:17:39 2010 -0700
@@ -2653,8 +2653,10 @@ 
     start = this->expression(PRECEDENCE_NORMAL, false, true, NULL);
   else
     {
-      this->error("missing lower bound in slice expression");
-      start = Expression::make_error(this->location());
+      mpz_t zero;
+      mpz_init_set_ui(zero, 0);
+      start = Expression::make_integer(&zero, NULL, location);
+      mpz_clear(zero);
     }
 
   Expression* end = NULL;