| 1 |
// { dg-do compile } |
| 2 |
// { dg-options "-fgo-debug-optimization" } |
| 3 |
// This comment is necessary to work around a dejagnu bug. Otherwise, the |
| 4 |
// column of the second error message would equal the row of the first one, and |
| 5 |
// since the errors are also identical, dejagnu is not able to distinguish them. |
| 6 |
|
| 7 |
package p |
| 8 |
|
| 9 |
var a [10]int |
| 10 |
|
| 11 |
func arrayClear() { |
| 12 |
for i := range a { // { dg-error "array range clear" } |
| 13 |
a[i] = 0 |
| 14 |
} |
| 15 |
} |
| 16 |
|
| 17 |
var s []int |
| 18 |
|
| 19 |
func sliceClear() { |
| 20 |
for i := range s { // { dg-error "array range clear" } |
| 21 |
s[i] = 0 |
| 22 |
} |
| 23 |
} |