From 5dfb4d0f3339595881fba857ab5a4b57c681a8e3 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 5 Feb 2018 01:57:42 +0000 Subject: compiler: update iota handling, fix using iota in array length CL 71750 changed the definition of how iota works. This patch updates gccgo for the new definition. We've been mishandling iota appearing in a type that appears in a const expression, as in `c = len([iota]int{})`. Correct that by copying type expressions when we copy an expression. For simplicity only copy when it can change the size of a type, as that is the only case where iota in a type can affect the value of a constant (I think). This is still a bunch of changes, but almost all boilerplate. Fixes golang/go#22341 Reviewed-on: https://go-review.googlesource.com/91475 From-SVN: r257379 --- gcc/go/gofrontend/parse.h | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'gcc/go/gofrontend/parse.h') diff --git a/gcc/go/gofrontend/parse.h b/gcc/go/gofrontend/parse.h index 2ba8457..f309ee0 100644 --- a/gcc/go/gofrontend/parse.h +++ b/gcc/go/gofrontend/parse.h @@ -7,7 +7,6 @@ #ifndef GO_PARSE_H #define GO_PARSE_H -class Set_iota_traverse; class Lex; class Gogo; class Named_object; @@ -185,7 +184,7 @@ class Parse void decl(void (Parse::*)(void*, unsigned int), void*, unsigned int pragmas); void list(void (Parse::*)(void*, unsigned int), void*, bool); void const_decl(); - void const_spec(Type**, Expression_list**); + void const_spec(int, Type**, Expression_list**); void type_decl(unsigned int pragmas); void type_spec(void*, unsigned int pragmas); void var_decl(); @@ -280,10 +279,6 @@ class Parse void import_decl(); void import_spec(void*, unsigned int pragmas); - void reset_iota(); - int iota_value(); - void increment_iota(); - // Skip past an error looking for a semicolon or OP. Return true if // all is well, false if we found EOF. bool @@ -319,8 +314,6 @@ class Parse Bc_stack* break_stack_; // A stack of statements for which continue may be used. Bc_stack* continue_stack_; - // The current iota value. - int iota_; // References from the local function to variables defined in // enclosing functions. Enclosing_vars enclosing_vars_; -- cgit v1.1