Russ Cox | 0b477ef | 2012-02-16 23:48:57 -0500 | [diff] [blame] | 1 | // run |
Rob Pike | 094ee44 | 2008-06-06 16:56:18 -0700 | [diff] [blame] | 2 | |
| 3 | // Copyright 2009 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 main |
| 8 | |
| 9 | |
| 10 | func main() { |
| 11 | var u30 uint64 = 0; |
| 12 | var u31 uint64 = 1; |
Russ Cox | 1a31989 | 2009-09-14 21:03:53 -0700 | [diff] [blame] | 13 | _, _ = u30, u31; |
Rob Pike | 094ee44 | 2008-06-06 16:56:18 -0700 | [diff] [blame] | 14 | var u32 uint64 = 18446744073709551615; |
| 15 | var u33 uint64 = +18446744073709551615; |
Rob Pike | bc2f5f1 | 2008-08-11 22:07:49 -0700 | [diff] [blame] | 16 | if u32 != (1<<64)-1 { panic("u32\n"); } |
| 17 | if u33 != (1<<64)-1 { panic("u33\n"); } |
Rob Pike | cbaca0b | 2008-08-11 13:08:16 -0700 | [diff] [blame] | 18 | var i34 int64 = ^0; // note: 2's complement means ^0 == -1 |
Rob Pike | bc2f5f1 | 2008-08-11 22:07:49 -0700 | [diff] [blame] | 19 | if i34 != -1 { panic("i34") } |
Rob Pike | 094ee44 | 2008-06-06 16:56:18 -0700 | [diff] [blame] | 20 | } |
| 21 | /* |
| 22 | bug12.go:5: overflow converting constant to <uint64>UINT64 |
| 23 | bug12.go:6: overflow converting constant to <uint64>UINT64 |
| 24 | bug12.go:7: overflow converting constant to <uint64>UINT64 |
| 25 | bug12.go:8: overflow converting constant to <uint64>UINT64 |
| 26 | */ |