Source file test/fixedbugs/issue24763.go

     1  // run
     2  
     3  // Copyright 2018 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  func main() {
    10  	var s uint
    11  	var x = interface{}(1<<s + 1<<s) // compiler must not crash here
    12  	if x.(int) != 2 {
    13  		panic("x not int or not 2")
    14  	}
    15  
    16  	var y interface{}
    17  	y = 1<<s + 1 // compiler must not crash here
    18  	if y.(int) != 2 {
    19  		panic("y not int or not 2")
    20  	}
    21  }
    22  

View as plain text