diff options
Diffstat (limited to 'test/const2.go')
-rw-r--r-- | test/const2.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/const2.go b/test/const2.go index 048d0cb9f3..d104a2fa71 100644 --- a/test/const2.go +++ b/test/const2.go @@ -19,3 +19,14 @@ const LargeB = LargeA * LargeA * LargeA const LargeC = LargeB * LargeB * LargeB // GC_ERROR "constant multiplication overflow" const AlsoLargeA = LargeA << 400 << 400 >> 400 >> 400 // GC_ERROR "constant shift overflow" + +// Issue #42732. + +const a = 1e+500000000 +const b = a * a // ERROR "constant multiplication overflow" +const c = b * b + +const MaxInt512 = (1<<256 - 1) * (1<<256 + 1) +const _ = MaxInt512 + 1 // ERROR "constant addition overflow" +const _ = MaxInt512 ^ -1 // ERROR "constant bitwise XOR overflow" +const _ = ^MaxInt512 // ERROR "constant bitwise complement overflow" |