Source file test/fixedbugs/issue52438.go

     1  // run
     2  
     3  // Copyright 2022 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  package main
     8  
     9  const c1 = iota
    10  const c2 = iota
    11  
    12  const c3 = 0 + iota<<8
    13  const c4 = 1 + iota<<8
    14  
    15  func main() {
    16  	if c1 != 0 {
    17  		panic(c1)
    18  	}
    19  	if c2 != 0 {
    20  		panic(c2)
    21  	}
    22  
    23  	if c3 != 0 {
    24  		panic(c3)
    25  	}
    26  	if c4 != 1 {
    27  		panic(c4)
    28  	}
    29  
    30  	const c5 = iota
    31  	const c6 = iota
    32  
    33  	if c5 != 0 {
    34  		panic(c5)
    35  	}
    36  	if c6 != 0 {
    37  		panic(c6)
    38  	}
    39  }
    40  

View as plain text