blob: 38efb6d979225ae94393e06d4aa8030f1f4cf7e6 [file] [log] [blame]
Russ Cox0b477ef2012-02-16 23:48:57 -05001// run
Rob Pike094ee442008-06-06 16:56:18 -07002
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
7package main
8
9
10func main() {
11 var u30 uint64 = 0;
12 var u31 uint64 = 1;
Russ Cox1a319892009-09-14 21:03:53 -070013 _, _ = u30, u31;
Rob Pike094ee442008-06-06 16:56:18 -070014 var u32 uint64 = 18446744073709551615;
15 var u33 uint64 = +18446744073709551615;
Rob Pikebc2f5f12008-08-11 22:07:49 -070016 if u32 != (1<<64)-1 { panic("u32\n"); }
17 if u33 != (1<<64)-1 { panic("u33\n"); }
Rob Pikecbaca0b2008-08-11 13:08:16 -070018 var i34 int64 = ^0; // note: 2's complement means ^0 == -1
Rob Pikebc2f5f12008-08-11 22:07:49 -070019 if i34 != -1 { panic("i34") }
Rob Pike094ee442008-06-06 16:56:18 -070020}
21/*
22bug12.go:5: overflow converting constant to <uint64>UINT64
23bug12.go:6: overflow converting constant to <uint64>UINT64
24bug12.go:7: overflow converting constant to <uint64>UINT64
25bug12.go:8: overflow converting constant to <uint64>UINT64
26*/