Russ Cox | 57eb06f | 2012-02-16 23:51:04 -0500 | [diff] [blame] | 1 | // errorcheck |
Robert Griesemer | 8c20787 | 2011-05-25 10:26:06 -0700 | [diff] [blame] | 2 | |
Emmanuel Odeke | 53fd522 | 2016-04-10 14:32:26 -0700 | [diff] [blame] | 3 | // Copyright 2011 The Go Authors. All rights reserved. |
Robert Griesemer | 8c20787 | 2011-05-25 10:26:06 -0700 | [diff] [blame] | 4 | // Use of this source code is governed by a BSD-style |
| 5 | // license that can be found in the LICENSE file. |
| 6 | |
Rob Pike | 80a9783 | 2012-02-24 11:48:19 +1100 | [diff] [blame] | 7 | // Test illegal shifts. |
Robert Griesemer | 8c20787 | 2011-05-25 10:26:06 -0700 | [diff] [blame] | 8 | // Issue 1708, illegal cases. |
Rob Pike | 80a9783 | 2012-02-24 11:48:19 +1100 | [diff] [blame] | 9 | // Does not compile. |
Robert Griesemer | 8c20787 | 2011-05-25 10:26:06 -0700 | [diff] [blame] | 10 | |
| 11 | package p |
| 12 | |
| 13 | func f(x int) int { return 0 } |
| 14 | func g(x interface{}) int { return 0 } |
| 15 | func h(x float64) int { return 0 } |
| 16 | |
| 17 | // from the spec |
| 18 | var ( |
| 19 | s uint = 33 |
Ian Lance Taylor | 9169c27 | 2011-09-21 17:25:48 -0700 | [diff] [blame] | 20 | u = 1.0 << s // ERROR "invalid operation|shift of non-integer operand" |
Matthew Dempsky | 581526c | 2019-09-05 13:33:06 -0700 | [diff] [blame] | 21 | v float32 = 1 << s // ERROR "invalid" |
Robert Griesemer | 8c20787 | 2011-05-25 10:26:06 -0700 | [diff] [blame] | 22 | ) |
| 23 | |
| 24 | // non-constant shift expressions |
| 25 | var ( |
Matthew Dempsky | 581526c | 2019-09-05 13:33:06 -0700 | [diff] [blame] | 26 | e1 = g(2.0 << s) // ERROR "invalid|shift of non-integer operand" |
| 27 | f1 = h(2 << s) // ERROR "invalid" |
Dan Scales | 29483b3 | 2021-11-27 10:33:59 -0800 | [diff] [blame] | 28 | g1 int64 = 1.1 << s // ERROR "truncated|must be integer" |
Robert Griesemer | 8c20787 | 2011-05-25 10:26:06 -0700 | [diff] [blame] | 29 | ) |
| 30 | |
| 31 | // constant shift expressions |
| 32 | const c uint = 65 |
| 33 | |
| 34 | var ( |
| 35 | a2 int = 1.0 << c // ERROR "overflow" |
| 36 | b2 = 1.0 << c // ERROR "overflow" |
| 37 | d2 = f(1.0 << c) // ERROR "overflow" |
| 38 | ) |
Rémy Oudompheng | a85fce2 | 2013-03-04 16:51:42 +0100 | [diff] [blame] | 39 | |
| 40 | var ( |
| 41 | // issues 4882, 4936. |
Ian Lance Taylor | 1761e25 | 2013-06-26 08:23:52 -0700 | [diff] [blame] | 42 | a3 = 1.0<<s + 0 // ERROR "invalid|shift of non-integer operand" |
Rémy Oudompheng | a85fce2 | 2013-03-04 16:51:42 +0100 | [diff] [blame] | 43 | // issue 4937 |
Ian Lance Taylor | 1761e25 | 2013-06-26 08:23:52 -0700 | [diff] [blame] | 44 | b3 = 1<<s + 1 + 1.0 // ERROR "invalid|shift of non-integer operand" |
Rémy Oudompheng | 861aa46 | 2013-03-16 00:37:28 +0100 | [diff] [blame] | 45 | // issue 5014 |
Ian Lance Taylor | 1761e25 | 2013-06-26 08:23:52 -0700 | [diff] [blame] | 46 | c3 = complex(1<<s, 0) // ERROR "invalid|shift of type float64" |
Dan Scales | 29483b3 | 2021-11-27 10:33:59 -0800 | [diff] [blame] | 47 | d3 int = complex(1<<s, 3) // ERROR "non-integer|cannot use.*as type int" "shift of type float64|must be integer" |
Rémy Oudompheng | 861aa46 | 2013-03-16 00:37:28 +0100 | [diff] [blame] | 48 | e3 = real(1 << s) // ERROR "invalid" |
| 49 | f3 = imag(1 << s) // ERROR "invalid" |
| 50 | ) |
| 51 | |
Robert Griesemer | f8ff689 | 2013-03-21 16:56:59 -0700 | [diff] [blame] | 52 | // from the spec |
| 53 | func _() { |
| 54 | var ( |
| 55 | s uint = 33 |
| 56 | i = 1 << s // 1 has type int |
| 57 | j int32 = 1 << s // 1 has type int32; j == 0 |
| 58 | k = uint64(1 << s) // 1 has type uint64; k == 1<<33 |
| 59 | m int = 1.0 << s // 1.0 has type int |
| 60 | n = 1.0<<s != i // 1.0 has type int; n == false if ints are 32bits in size |
| 61 | o = 1<<s == 2<<s // 1 and 2 have type int; o == true if ints are 32bits in size |
| 62 | // next test only fails on 32bit systems |
| 63 | // p = 1<<s == 1<<33 // illegal if ints are 32bits in size: 1 has type int, but 1<<33 overflows int |
Ian Lance Taylor | 1761e25 | 2013-06-26 08:23:52 -0700 | [diff] [blame] | 64 | u = 1.0 << s // ERROR "non-integer|float64" |
| 65 | u1 = 1.0<<s != 0 // ERROR "non-integer|float64" |
| 66 | u2 = 1<<s != 1.0 // ERROR "non-integer|float64" |
| 67 | v float32 = 1 << s // ERROR "non-integer|float32" |
Robert Griesemer | f8ff689 | 2013-03-21 16:56:59 -0700 | [diff] [blame] | 68 | w int64 = 1.0 << 33 // 1.0<<33 is a constant shift expression |
Matthew Dempsky | 581526c | 2019-09-05 13:33:06 -0700 | [diff] [blame] | 69 | |
Ian Lance Taylor | 1761e25 | 2013-06-26 08:23:52 -0700 | [diff] [blame] | 70 | _, _, _, _, _, _, _, _, _, _ = j, k, m, n, o, u, u1, u2, v, w |
Robert Griesemer | f8ff689 | 2013-03-21 16:56:59 -0700 | [diff] [blame] | 71 | ) |
Alberto Donizetti | 1737aef | 2017-04-22 15:28:58 +0200 | [diff] [blame] | 72 | |
| 73 | // non constants arguments trigger a different path |
| 74 | f2 := 1.2 |
| 75 | s2 := "hi" |
Dan Scales | 29483b3 | 2021-11-27 10:33:59 -0800 | [diff] [blame] | 76 | _ = f2 << 2 // ERROR "shift of type float64|non-integer|must be integer" |
| 77 | _ = s2 << 2 // ERROR "shift of type string|non-integer|must be integer" |
Robert Griesemer | f8ff689 | 2013-03-21 16:56:59 -0700 | [diff] [blame] | 78 | } |
| 79 | |
| 80 | // shifts in comparisons w/ untyped operands |
Rémy Oudompheng | 861aa46 | 2013-03-16 00:37:28 +0100 | [diff] [blame] | 81 | var ( |
Robert Griesemer | f8ff689 | 2013-03-21 16:56:59 -0700 | [diff] [blame] | 82 | _ = 1<<s == 1 |
Ian Lance Taylor | 1761e25 | 2013-06-26 08:23:52 -0700 | [diff] [blame] | 83 | _ = 1<<s == 1. // ERROR "invalid|shift of type float64" |
| 84 | _ = 1.<<s == 1 // ERROR "invalid|shift of type float64" |
| 85 | _ = 1.<<s == 1. // ERROR "invalid|non-integer|shift of type float64" |
Robert Griesemer | f8ff689 | 2013-03-21 16:56:59 -0700 | [diff] [blame] | 86 | |
| 87 | _ = 1<<s+1 == 1 |
Ian Lance Taylor | 1761e25 | 2013-06-26 08:23:52 -0700 | [diff] [blame] | 88 | _ = 1<<s+1 == 1. // ERROR "invalid|shift of type float64" |
| 89 | _ = 1<<s+1. == 1 // ERROR "invalid|shift of type float64" |
| 90 | _ = 1<<s+1. == 1. // ERROR "invalid|shift of type float64" |
| 91 | _ = 1.<<s+1 == 1 // ERROR "invalid|shift of type float64" |
| 92 | _ = 1.<<s+1 == 1. // ERROR "invalid|shift of type float64" |
| 93 | _ = 1.<<s+1. == 1 // ERROR "invalid|shift of type float64" |
| 94 | _ = 1.<<s+1. == 1. // ERROR "invalid|non-integer|shift of type float64" |
Robert Griesemer | f8ff689 | 2013-03-21 16:56:59 -0700 | [diff] [blame] | 95 | |
| 96 | _ = 1<<s == 1<<s |
Ian Lance Taylor | 1761e25 | 2013-06-26 08:23:52 -0700 | [diff] [blame] | 97 | _ = 1<<s == 1.<<s // ERROR "invalid|shift of type float64" |
| 98 | _ = 1.<<s == 1<<s // ERROR "invalid|shift of type float64" |
| 99 | _ = 1.<<s == 1.<<s // ERROR "invalid|non-integer|shift of type float64" |
Robert Griesemer | f8ff689 | 2013-03-21 16:56:59 -0700 | [diff] [blame] | 100 | |
| 101 | _ = 1<<s+1<<s == 1 |
Ian Lance Taylor | 1761e25 | 2013-06-26 08:23:52 -0700 | [diff] [blame] | 102 | _ = 1<<s+1<<s == 1. // ERROR "invalid|shift of type float64" |
| 103 | _ = 1<<s+1.<<s == 1 // ERROR "invalid|shift of type float64" |
| 104 | _ = 1<<s+1.<<s == 1. // ERROR "invalid|shift of type float64" |
| 105 | _ = 1.<<s+1<<s == 1 // ERROR "invalid|shift of type float64" |
| 106 | _ = 1.<<s+1<<s == 1. // ERROR "invalid|shift of type float64" |
| 107 | _ = 1.<<s+1.<<s == 1 // ERROR "invalid|shift of type float64" |
| 108 | _ = 1.<<s+1.<<s == 1. // ERROR "invalid|non-integer|shift of type float64" |
Robert Griesemer | f8ff689 | 2013-03-21 16:56:59 -0700 | [diff] [blame] | 109 | |
| 110 | _ = 1<<s+1<<s == 1<<s+1<<s |
Ian Lance Taylor | 1761e25 | 2013-06-26 08:23:52 -0700 | [diff] [blame] | 111 | _ = 1<<s+1<<s == 1<<s+1.<<s // ERROR "invalid|shift of type float64" |
| 112 | _ = 1<<s+1<<s == 1.<<s+1<<s // ERROR "invalid|shift of type float64" |
| 113 | _ = 1<<s+1<<s == 1.<<s+1.<<s // ERROR "invalid|shift of type float64" |
| 114 | _ = 1<<s+1.<<s == 1<<s+1<<s // ERROR "invalid|shift of type float64" |
| 115 | _ = 1<<s+1.<<s == 1<<s+1.<<s // ERROR "invalid|shift of type float64" |
| 116 | _ = 1<<s+1.<<s == 1.<<s+1<<s // ERROR "invalid|shift of type float64" |
| 117 | _ = 1<<s+1.<<s == 1.<<s+1.<<s // ERROR "invalid|non-integer|shift of type float64" |
| 118 | _ = 1.<<s+1<<s == 1<<s+1<<s // ERROR "invalid|shift of type float64" |
| 119 | _ = 1.<<s+1<<s == 1<<s+1.<<s // ERROR "invalid|shift of type float64" |
| 120 | _ = 1.<<s+1<<s == 1.<<s+1<<s // ERROR "invalid|shift of type float64" |
| 121 | _ = 1.<<s+1<<s == 1.<<s+1.<<s // ERROR "invalid|non-integer|shift of type float64" |
| 122 | _ = 1.<<s+1.<<s == 1<<s+1<<s // ERROR "invalid|shift of type float64" |
| 123 | _ = 1.<<s+1.<<s == 1<<s+1.<<s // ERROR "invalid|non-integer|shift of type float64" |
| 124 | _ = 1.<<s+1.<<s == 1.<<s+1<<s // ERROR "invalid|non-integer|shift of type float64" |
| 125 | _ = 1.<<s+1.<<s == 1.<<s+1.<<s // ERROR "invalid|non-integer|shift of type float64" |
Rémy Oudompheng | a85fce2 | 2013-03-04 16:51:42 +0100 | [diff] [blame] | 126 | ) |
Robert Griesemer | f8ff689 | 2013-03-21 16:56:59 -0700 | [diff] [blame] | 127 | |
| 128 | // shifts in comparisons w/ typed operands |
| 129 | var ( |
| 130 | x int |
| 131 | _ = 1<<s == x |
| 132 | _ = 1.<<s == x |
Dan Scales | 29483b3 | 2021-11-27 10:33:59 -0800 | [diff] [blame] | 133 | _ = 1.1<<s == x // ERROR "truncated|must be integer" |
Robert Griesemer | f8ff689 | 2013-03-21 16:56:59 -0700 | [diff] [blame] | 134 | |
| 135 | _ = 1<<s+x == 1 |
| 136 | _ = 1<<s+x == 1. |
Ian Lance Taylor | 1761e25 | 2013-06-26 08:23:52 -0700 | [diff] [blame] | 137 | _ = 1<<s+x == 1.1 // ERROR "truncated" |
Robert Griesemer | f8ff689 | 2013-03-21 16:56:59 -0700 | [diff] [blame] | 138 | _ = 1.<<s+x == 1 |
| 139 | _ = 1.<<s+x == 1. |
Ian Lance Taylor | 1761e25 | 2013-06-26 08:23:52 -0700 | [diff] [blame] | 140 | _ = 1.<<s+x == 1.1 // ERROR "truncated" |
Dan Scales | 29483b3 | 2021-11-27 10:33:59 -0800 | [diff] [blame] | 141 | _ = 1.1<<s+x == 1 // ERROR "truncated|must be integer" |
| 142 | _ = 1.1<<s+x == 1. // ERROR "truncated|must be integer" |
| 143 | _ = 1.1<<s+x == 1.1 // ERROR "truncated|must be integer" |
Robert Griesemer | f8ff689 | 2013-03-21 16:56:59 -0700 | [diff] [blame] | 144 | |
| 145 | _ = 1<<s == x<<s |
| 146 | _ = 1.<<s == x<<s |
Dan Scales | 29483b3 | 2021-11-27 10:33:59 -0800 | [diff] [blame] | 147 | _ = 1.1<<s == x<<s // ERROR "truncated|must be integer" |
Robert Griesemer | f8ff689 | 2013-03-21 16:56:59 -0700 | [diff] [blame] | 148 | ) |
| 149 | |
| 150 | // shifts as operands in non-arithmetic operations and as arguments |
| 151 | func _() { |
| 152 | var s uint |
| 153 | var a []int |
| 154 | _ = a[1<<s] |
| 155 | _ = a[1.] |
Robert Griesemer | 088a9ad | 2017-11-30 15:47:46 -0800 | [diff] [blame] | 156 | _ = a[1.<<s] |
Ian Lance Taylor | 1761e25 | 2013-06-26 08:23:52 -0700 | [diff] [blame] | 157 | _ = a[1.1<<s] // ERROR "integer|shift of type float64" |
Robert Griesemer | f8ff689 | 2013-03-21 16:56:59 -0700 | [diff] [blame] | 158 | |
| 159 | _ = make([]int, 1) |
| 160 | _ = make([]int, 1.) |
| 161 | _ = make([]int, 1.<<s) |
Dan Scales | 29483b3 | 2021-11-27 10:33:59 -0800 | [diff] [blame] | 162 | _ = make([]int, 1.1<<s) // ERROR "non-integer|truncated|must be integer" |
Robert Griesemer | f8ff689 | 2013-03-21 16:56:59 -0700 | [diff] [blame] | 163 | |
| 164 | _ = float32(1) |
Dan Scales | 29483b3 | 2021-11-27 10:33:59 -0800 | [diff] [blame] | 165 | _ = float32(1 << s) // ERROR "non-integer|shift of type float32|must be integer" |
Robert Griesemer | f8ff689 | 2013-03-21 16:56:59 -0700 | [diff] [blame] | 166 | _ = float32(1.) |
Dan Scales | 29483b3 | 2021-11-27 10:33:59 -0800 | [diff] [blame] | 167 | _ = float32(1. << s) // ERROR "non-integer|shift of type float32|must be integer" |
| 168 | _ = float32(1.1 << s) // ERROR "non-integer|shift of type float32|must be integer" |
Robert Griesemer | f8ff689 | 2013-03-21 16:56:59 -0700 | [diff] [blame] | 169 | |
| 170 | _ = append(a, 1<<s) |
| 171 | _ = append(a, 1.<<s) |
Dan Scales | 29483b3 | 2021-11-27 10:33:59 -0800 | [diff] [blame] | 172 | _ = append(a, 1.1<<s) // ERROR "truncated|must be integer" |
Robert Griesemer | f8ff689 | 2013-03-21 16:56:59 -0700 | [diff] [blame] | 173 | |
| 174 | var b []float32 |
Ian Lance Taylor | 1761e25 | 2013-06-26 08:23:52 -0700 | [diff] [blame] | 175 | _ = append(b, 1<<s) // ERROR "non-integer|type float32" |
| 176 | _ = append(b, 1.<<s) // ERROR "non-integer|type float32" |
Dan Scales | 29483b3 | 2021-11-27 10:33:59 -0800 | [diff] [blame] | 177 | _ = append(b, 1.1<<s) // ERROR "non-integer|type float32|must be integer" |
Robert Griesemer | f8ff689 | 2013-03-21 16:56:59 -0700 | [diff] [blame] | 178 | |
Dan Scales | 29483b3 | 2021-11-27 10:33:59 -0800 | [diff] [blame] | 179 | _ = complex(1.<<s, 0) // ERROR "non-integer|shift of type float64|must be integer" |
| 180 | _ = complex(1.1<<s, 0) // ERROR "non-integer|shift of type float64|must be integer" |
| 181 | _ = complex(0, 1.<<s) // ERROR "non-integer|shift of type float64|must be integer" |
| 182 | _ = complex(0, 1.1<<s) // ERROR "non-integer|shift of type float64|must be integer" |
Robert Griesemer | f8ff689 | 2013-03-21 16:56:59 -0700 | [diff] [blame] | 183 | |
| 184 | var a4 float64 |
| 185 | var b4 int |
Dan Scales | 29483b3 | 2021-11-27 10:33:59 -0800 | [diff] [blame] | 186 | _ = complex(1<<s, a4) // ERROR "non-integer|shift of type float64|must be integer" |
Ian Lance Taylor | 1761e25 | 2013-06-26 08:23:52 -0700 | [diff] [blame] | 187 | _ = complex(1<<s, b4) // ERROR "invalid|non-integer|" |
Robert Griesemer | f8ff689 | 2013-03-21 16:56:59 -0700 | [diff] [blame] | 188 | |
| 189 | var m1 map[int]string |
| 190 | delete(m1, 1<<s) |
| 191 | delete(m1, 1.<<s) |
Dan Scales | 29483b3 | 2021-11-27 10:33:59 -0800 | [diff] [blame] | 192 | delete(m1, 1.1<<s) // ERROR "truncated|shift of type float64|must be integer" |
Robert Griesemer | f8ff689 | 2013-03-21 16:56:59 -0700 | [diff] [blame] | 193 | |
| 194 | var m2 map[float32]string |
| 195 | delete(m2, 1<<s) // ERROR "invalid|cannot use 1 << s as type float32" |
| 196 | delete(m2, 1.<<s) // ERROR "invalid|cannot use 1 << s as type float32" |
| 197 | delete(m2, 1.1<<s) // ERROR "invalid|cannot use 1.1 << s as type float32" |
| 198 | } |
| 199 | |
| 200 | // shifts of shifts |
| 201 | func _() { |
| 202 | var s uint |
| 203 | _ = 1 << (1 << s) |
| 204 | _ = 1 << (1. << s) |
Dan Scales | 29483b3 | 2021-11-27 10:33:59 -0800 | [diff] [blame] | 205 | _ = 1 << (1.1 << s) // ERROR "non-integer|truncated|must be integer" |
| 206 | _ = 1. << (1 << s) // ERROR "non-integer|shift of type float64|must be integer" |
| 207 | _ = 1. << (1. << s) // ERROR "non-integer|shift of type float64|must be integer" |
Ian Lance Taylor | 1761e25 | 2013-06-26 08:23:52 -0700 | [diff] [blame] | 208 | _ = 1.1 << (1.1 << s) // ERROR "invalid|non-integer|truncated" |
Robert Griesemer | f8ff689 | 2013-03-21 16:56:59 -0700 | [diff] [blame] | 209 | |
| 210 | _ = (1 << s) << (1 << s) |
| 211 | _ = (1 << s) << (1. << s) |
Dan Scales | 29483b3 | 2021-11-27 10:33:59 -0800 | [diff] [blame] | 212 | _ = (1 << s) << (1.1 << s) // ERROR "truncated|must be integer" |
| 213 | _ = (1. << s) << (1 << s) // ERROR "non-integer|shift of type float64|must be integer" |
| 214 | _ = (1. << s) << (1. << s) // ERROR "non-integer|shift of type float64|must be integer" |
Ian Lance Taylor | 1761e25 | 2013-06-26 08:23:52 -0700 | [diff] [blame] | 215 | _ = (1.1 << s) << (1.1 << s) // ERROR "invalid|non-integer|truncated" |
Robert Griesemer | f8ff689 | 2013-03-21 16:56:59 -0700 | [diff] [blame] | 216 | |
| 217 | var x int |
| 218 | x = 1 << (1 << s) |
| 219 | x = 1 << (1. << s) |
Dan Scales | 29483b3 | 2021-11-27 10:33:59 -0800 | [diff] [blame] | 220 | x = 1 << (1.1 << s) // ERROR "truncated|must be integer" |
Robert Griesemer | f8ff689 | 2013-03-21 16:56:59 -0700 | [diff] [blame] | 221 | x = 1. << (1 << s) |
| 222 | x = 1. << (1. << s) |
Dan Scales | 29483b3 | 2021-11-27 10:33:59 -0800 | [diff] [blame] | 223 | x = 1.1 << (1.1 << s) // ERROR "truncated|must be integer" |
Robert Griesemer | f8ff689 | 2013-03-21 16:56:59 -0700 | [diff] [blame] | 224 | |
| 225 | x = (1 << s) << (1 << s) |
| 226 | x = (1 << s) << (1. << s) |
Dan Scales | 29483b3 | 2021-11-27 10:33:59 -0800 | [diff] [blame] | 227 | x = (1 << s) << (1.1 << s) // ERROR "truncated|must be integer" |
Robert Griesemer | f8ff689 | 2013-03-21 16:56:59 -0700 | [diff] [blame] | 228 | x = (1. << s) << (1 << s) |
| 229 | x = (1. << s) << (1. << s) |
Dan Scales | 29483b3 | 2021-11-27 10:33:59 -0800 | [diff] [blame] | 230 | x = (1.1 << s) << (1.1 << s) // ERROR "truncated|must be integer" |
Robert Griesemer | f8ff689 | 2013-03-21 16:56:59 -0700 | [diff] [blame] | 231 | |
| 232 | var y float32 |
Ian Lance Taylor | 1761e25 | 2013-06-26 08:23:52 -0700 | [diff] [blame] | 233 | y = 1 << (1 << s) // ERROR "non-integer|type float32" |
| 234 | y = 1 << (1. << s) // ERROR "non-integer|type float32" |
| 235 | y = 1 << (1.1 << s) // ERROR "invalid|truncated|float32" |
| 236 | y = 1. << (1 << s) // ERROR "non-integer|type float32" |
| 237 | y = 1. << (1. << s) // ERROR "non-integer|type float32" |
| 238 | y = 1.1 << (1.1 << s) // ERROR "invalid|truncated|float32" |
Robert Griesemer | f8ff689 | 2013-03-21 16:56:59 -0700 | [diff] [blame] | 239 | |
| 240 | var z complex128 |
Ian Lance Taylor | 1761e25 | 2013-06-26 08:23:52 -0700 | [diff] [blame] | 241 | z = (1 << s) << (1 << s) // ERROR "non-integer|type complex128" |
| 242 | z = (1 << s) << (1. << s) // ERROR "non-integer|type complex128" |
| 243 | z = (1 << s) << (1.1 << s) // ERROR "invalid|truncated|complex128" |
Dan Scales | 29483b3 | 2021-11-27 10:33:59 -0800 | [diff] [blame] | 244 | z = (1. << s) << (1 << s) // ERROR "non-integer|type complex128|must be integer" |
| 245 | z = (1. << s) << (1. << s) // ERROR "non-integer|type complex128|must be integer" |
Ian Lance Taylor | 1761e25 | 2013-06-26 08:23:52 -0700 | [diff] [blame] | 246 | z = (1.1 << s) << (1.1 << s) // ERROR "invalid|truncated|complex128" |
Ian Lance Taylor | 8259b01 | 2014-07-20 12:25:24 -0700 | [diff] [blame] | 247 | |
| 248 | _, _, _ = x, y, z |
Robert Griesemer | f8ff689 | 2013-03-21 16:56:59 -0700 | [diff] [blame] | 249 | } |