Source file test/fixedbugs/bug012.go

     1  // run
     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;
    13  	_, _ = u30, u31;
    14  	var u32 uint64 = 18446744073709551615;
    15  	var u33 uint64 = +18446744073709551615;
    16  	if u32 != (1<<64)-1 { panic("u32\n"); }
    17  	if u33 != (1<<64)-1 { panic("u33\n"); }
    18  	var i34 int64 = ^0;  // note: 2's complement means ^0 == -1
    19  	if i34 != -1 { panic("i34") }
    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  */
    27  

View as plain text