1 // -lang=go1.12 2 3 // Copyright 2022 The Go Authors. All rights reserved. 4 // Use of this source code is governed by a BSD-style 5 // license that can be found in the LICENSE file. 6 7 package p 8 9 type resultFlags uint 10 11 // Example from #52031. 12 // 13 // The following shifts should not produce errors on Go < 1.13, as their 14 // untyped constant operands are representable by type uint. 15 const ( 16 _ resultFlags = (1 << iota) / 2 17 18 reportEqual 19 reportUnequal 20 reportByIgnore 21 reportByMethod 22 reportByFunc 23 reportByCycle 24 ) 25 26 // Invalid cases. 27 var x int = 1 28 var _ = (8 << x /* ERRORx `signed shift count .* requires go1.13 or later` */) 29 30 const _ = (1 << 1.2 /* ERROR "truncated to uint" */) 31 32 var y float64 33 var _ = (1 << y /* ERROR "must be integer" */) 34