1 // errchk $G -e $D/$F.go
3 // Copyright 2011 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.
7 // Issue 1708, illegal cases.
11 func f(x int) int { return 0 }
12 func g(x interface{}) int { return 0 }
13 func h(x float64) int { return 0 }
18 u = 1.0 << s // ERROR "invalid operation"
19 v float32 = 1 << s // ERROR "invalid operation"
22 // non-constant shift expressions
24 e1 = g(2.0 << s) // ERROR "invalid operation"
25 f1 = h(2 << s) // ERROR "invalid operation"
26 g1 int64 = 1.1 << s // ERROR "truncated"
29 // constant shift expressions
33 a2 int = 1.0 << c // ERROR "overflow"
34 b2 = 1.0 << c // ERROR "overflow"
35 d2 = f(1.0 << c) // ERROR "overflow"