modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/testdata/errchk/test/fixedbugs/issue8183.go (about)

     1  // errorcheck
     2  
     3  // Copyright 2015 The Go Authors. All rights reserved.
     4  // Use of this source code is governed by a BSD-style
     5  // license that can be found in the LICENSE file.
     6  
     7  // Tests correct reporting of line numbers for errors involving iota,
     8  // Issue #8183.
     9  package foo
    10  
    11  const (
    12  	ok = byte(iota + 253)
    13  	bad
    14  	barn
    15  	bard // ERROR "constant 256 overflows byte"
    16  )
    17  
    18  const (
    19  	c = len([1 - iota]int{})
    20  	d
    21  	e // ERROR "array bound must be non-negative" "const initializer len\(composite literal\) is not a constant"
    22  	f // ERROR "array bound must be non-negative" "const initializer len\(composite literal\) is not a constant"
    23  )