mirror of https://github.com/golang/go.git
The spec is not conclusive about whether a non-constant shift of certain untyped constant left operands is valid when the shift expression appears as an index in an index or slice expression, or as a size in a `make` function call. Despite identical spec rules in all these cases, cmd/compile accepts make([]byte, 1.0 << s) but pronounces an error for a[1.0 << s] (go/types accepts both). This change clarifies the spec by explicitly stating that an untyped constant left operand in a non-constant shift (1.0 in the above examples) will be given type `int` in these contexts. A separate issue #21693 addresses the cmd/compile bug. Fixes #14844. Change-Id: I4b52125e487a607fae377fcbed55463cdce9836c Reviewed-on: https://go-review.googlesource.com/60230 Reviewed-by: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> |
||
|---|---|---|
| .. | ||
| articles | ||
| codewalk | ||
| devel | ||
| editors | ||
| gopher | ||
| play | ||
| progs | ||
| asm.html | ||
| cmd.html | ||
| code.html | ||
| conduct.html | ||
| contrib.html | ||
| contribute.html | ||
| debugging_with_gdb.html | ||
| docs.html | ||
| editors.html | ||
| effective_go.html | ||
| gccgo_contribute.html | ||
| gccgo_install.html | ||
| go-logo-black.png | ||
| go-logo-blue.png | ||
| go-logo-white.png | ||
| go1.1.html | ||
| go1.2.html | ||
| go1.3.html | ||
| go1.4.html | ||
| go1.5.html | ||
| go1.6.html | ||
| go1.7.html | ||
| go1.8.html | ||
| go1.9.html | ||
| go1.html | ||
| go1compat.html | ||
| go_faq.html | ||
| go_mem.html | ||
| go_spec.html | ||
| help.html | ||
| ie.css | ||
| install-source.html | ||
| install.html | ||
| root.html | ||
| security.html | ||
| share.png | ||
| tos.html | ||