diff options
author | Ian Lance Taylor <iant@golang.org> | 2020-12-05 18:42:30 -0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2020-12-07 09:44:18 -0800 |
commit | c3a1b3e6fb24ccf6f45e7d6ce904d5549bba01d6 (patch) | |
tree | 2676c757088d56745e0de9668d6f99c55c6c9e1b /gcc/go/gofrontend/statements.cc | |
parent | 7482d5a3acb7a8a5564f5cddc4f9d2ebbaea75e4 (diff) | |
download | gcc-c3a1b3e6fb24ccf6f45e7d6ce904d5549bba01d6.zip gcc-c3a1b3e6fb24ccf6f45e7d6ce904d5549bba01d6.tar.gz gcc-c3a1b3e6fb24ccf6f45e7d6ce904d5549bba01d6.tar.bz2 |
compiler: type of string index expression is byte
To make this work from the do_type method, add "byte" and "rune" to
the list of known integer types, and look them up that way rather than
via gogo->lookup_global.
For golang/go#8745
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/275653
Diffstat (limited to 'gcc/go/gofrontend/statements.cc')
-rw-r--r-- | gcc/go/gofrontend/statements.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/go/gofrontend/statements.cc b/gcc/go/gofrontend/statements.cc index 25e2536..af82f36 100644 --- a/gcc/go/gofrontend/statements.cc +++ b/gcc/go/gofrontend/statements.cc @@ -6341,7 +6341,7 @@ For_range_statement::do_lower(Gogo* gogo, Named_object*, Block* enclosing, else if (range_type->is_string_type()) { index_type = Type::lookup_integer_type("int"); - value_type = gogo->lookup_global("rune")->type_value(); + value_type = Type::lookup_integer_type("rune"); } else if (range_type->map_type() != NULL) { @@ -6812,7 +6812,7 @@ For_range_statement::lower_range_string(Gogo* gogo, rune_type = value_temp->type(); else { - rune_type = gogo->lookup_global("rune")->type_value(); + rune_type = Type::lookup_integer_type("rune"); value_temp = Statement::make_temporary(rune_type, NULL, loc); init->add_statement(value_temp); } |