From 4042194f2d9fd605bd8b6553043e8b195767c446 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Tue, 18 Jan 2022 18:04:30 -0800 Subject: [PATCH] spec: add another example for an invalid shift case Fixes #45114. Change-Id: I969e5f1037254fc0ffbba2fc07a81a3987e6b05f Reviewed-on: https://go-review.googlesource.com/c/go/+/379275 Trust: Robert Griesemer Run-TryBot: Robert Griesemer TryBot-Result: Gopher Robot Reviewed-by: Ian Lance Taylor --- doc/go_spec.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/go_spec.html b/doc/go_spec.html index 7c20236016..0d7de5e6d1 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1,6 +1,6 @@ @@ -4259,7 +4259,8 @@ var p = 1<<s == 1<<33 // 1 has type int; p == true var u = 1.0<<s // illegal: 1.0 has type float64, cannot shift var u1 = 1.0<<s != 0 // illegal: 1.0 has type float64, cannot shift var u2 = 1<<s != 1.0 // illegal: 1 has type float64, cannot shift -var v float32 = 1<<s // illegal: 1 has type float32, cannot shift +var v1 float32 = 1<<s // illegal: 1 has type float32, cannot shift +var v2 = string(1<<s) // illegal: 1 is converted to a string, cannot shift var w int64 = 1.0<<33 // 1.0<<33 is a constant shift expression; w == 1<<33 var x = a[1.0<<s] // panics: 1.0 has type int, but 1<<33 overflows array bounds var b = make([]byte, 1.0<<s) // 1.0 has type int; len(b) == 1<<33