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:
Rémy Oudompheng 2012-02-16 00:19:42 +01:00
parent 88f8af127a
commit 79db6ada48
2 changed files with 20 additions and 10 deletions

View file

@ -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"