blob: 9347ec28b62d4460c85aa4b0dca9cb9c5d43024c [file] [log] [blame]
Russ Cox43891922011-07-28 13:03:30 -04001// errchk $G $D/$F.go
2
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}