diff options
Diffstat (limited to 'test/const1.go')
-rw-r--r-- | test/const1.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/test/const1.go b/test/const1.go index bc399c01c..a170ce9e7 100644 --- a/test/const1.go +++ b/test/const1.go @@ -9,6 +9,8 @@ package main +import "unsafe" + type I interface{} const ( @@ -66,7 +68,7 @@ var ( c3 float64 = float64(Big) * Big // ERROR "overflow" c4 = Big * Big // ERROR "overflow" c5 = Big / 0 // ERROR "division by zero" - c6 = 1000 % 1e3 // ERROR "floating-point % operation" + c6 = 1000 % 1e3 // ERROR "floating-point % operation|expected integer type" ) func f(int) @@ -86,3 +88,7 @@ func main() { } const ptr = nil // ERROR "const.*nil" +const _ = string([]byte(nil)) // ERROR "is not a constant" +const _ = uintptr(unsafe.Pointer((*int)(nil))) // ERROR "is not a constant" +const _ = unsafe.Pointer((*int)(nil)) // ERROR "cannot be nil" +const _ = (*int)(nil) // ERROR "cannot be nil" |