src/cmd/vet/testdata/shift/shift.go
raw| 1 | // Copyright 2014 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | // This file contains tests for the suspicious shift checker. |
| 6 | |
| 7 | package shift |
| 8 | |
| 9 | func ShiftTest() { |
| 10 | var i8 int8 |
| 11 | _ = i8 << 7 |
| 12 | _ = (i8 + 1) << 8 // ERROR ".i8 . 1. .8 bits. too small for shift of 8" |
| 13 | } |