blob: 615c66865cbe15c93c63e0a0f5dffc7f55ff6d3a [file] [log] [blame]
Russ Cox80803842012-02-16 23:49:59 -05001// errorcheck
Russ Cox43891922011-07-28 13:03:30 -04002
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.
6
7// issue 1664
8
9package main
10
11func main() {
12 var i uint = 33
Ian Lance Taylor9169c272011-09-21 17:25:48 -070013 var a = (1<<i) + 4.5 // ERROR "shift of type float64|invalid.*shift"
Russ Cox43891922011-07-28 13:03:30 -040014 println(a)
15
Ian Lance Taylor9169c272011-09-21 17:25:48 -070016 var b = (1<<i) + 4.0 // ERROR "shift of type float64|invalid.*shift"
Russ Cox43891922011-07-28 13:03:30 -040017 println(b)
18
19 var c int64 = (1<<i) + 4.0 // ok - it's all int64
Ian Lance Taylor387e7c22012-01-22 11:50:45 -080020 println(c)
Russ Cox43891922011-07-28 13:03:30 -040021}