mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/gc: error on constant shift overflows.
Fixes #3019. R=golang-dev, rsc CC=golang-dev, remy https://golang.org/cl/5674044
This commit is contained in:
parent
88f8af127a
commit
79db6ada48
2 changed files with 20 additions and 10 deletions
|
|
@ -13,4 +13,6 @@ const (
|
|||
|
||||
const LargeA = 1000000000000000000
|
||||
const LargeB = LargeA * LargeA * LargeA
|
||||
const LargeC = LargeB * LargeB * LargeB // ERROR "constant multiplication overflow"
|
||||
const LargeC = LargeB * LargeB * LargeB // ERROR "constant multiplication overflow"
|
||||
|
||||
const AlsoLargeA = LargeA << 400 << 400 >> 400 >> 400 // ERROR "constant shift overflow"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue