summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2017-06-07 11:06:00 -0700
committerRobert Griesemer <gri@golang.org>2017-06-08 16:46:15 +0000
commite4ce08afe0a01b850e266efef52b03eab94a470f (patch)
tree9dbdef3fa84c5f6bc878cd9b86c0dc48d9a4767e /doc
parenta7d7d7aec26b18e8ae4581a30b7c0f5b4d0b9c6b (diff)
downloadgo-git-e4ce08afe0a01b850e266efef52b03eab94a470f.tar.gz
spec: clarify restrictions on RHS of non-constant shifts
For non-constant shifts with an untyped constant shift count, the spec only said that it must "be converted to unsigned integer type". go/types accepts any (arbitrarily large) integer value. Both cmd/compile and gccgo require that the shift count be representable as a uint value in that case (if the shift count is typed, it may be any unsigned integer type). This change adjusts the spec to state what the compilers have been doing all along. The new wording matches similar rules elsewhere (e.g., for untyped array and slice indices). Also, while technically this is a restriction (we could permit arbitrarily large shift counts), in practice this is irrelevant. Fixes #14822. Change-Id: Ia75834c67483cf761c10025c8df758f225ef67c2 Reviewed-on: https://go-review.googlesource.com/45072 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'doc')
-rw-r--r--doc/go_spec.html4
1 files changed, 2 insertions, 2 deletions
diff --git a/doc/go_spec.html b/doc/go_spec.html
index 9a1cf0a0fe..9ab0804609 100644
--- a/doc/go_spec.html
+++ b/doc/go_spec.html
@@ -1,6 +1,6 @@
<!--{
"Title": "The Go Programming Language Specification",
- "Subtitle": "Version of May 9, 2017",
+ "Subtitle": "Version of June 7, 2017",
"Path": "/ref/spec"
}-->
@@ -3384,7 +3384,7 @@ to the type of the other operand.
<p>
The right operand in a shift expression must have unsigned integer type
-or be an untyped constant that can be converted to unsigned integer type.
+or be an untyped constant representable by a value of type <code>uint</code>.
If the left operand of a non-constant shift expression is an untyped constant,
it is first converted to the type it would assume if the shift expression were
replaced by its left operand alone.