gcc/testsuite/go.test/test/fixedbugs/issue21887.go
raw| 1 | // run |
| 2 | |
| 3 | // Copyright 2017 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 21887: println(^uint(0)) fails to compile |
| 8 | |
| 9 | package main |
| 10 | |
| 11 | import "strconv" |
| 12 | |
| 13 | func main() { |
| 14 | if strconv.IntSize == 32 { |
| 15 | println(^uint(0)) |
| 16 | } else { |
| 17 | println(^uint32(0)) |
| 18 | } |
| 19 | |
| 20 | if strconv.IntSize == 64 { |
| 21 | println(^uint(0)) |
| 22 | } else { |
| 23 | println(^uint64(0)) |
| 24 | } |
| 25 | } |