Source file test/fixedbugs/issue38117.go

     1  // errorcheck
     2  
     3  // Copyright 2020 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  // cmd/compile erroneously rejected conversions of constant values
     8  // between int/float and complex types.
     9  
    10  package p
    11  
    12  const (
    13  	_ = int(complex64(int(0)))
    14  	_ = float64(complex128(float64(0)))
    15  
    16  	_ = int8(complex128(1000)) // ERROR "overflow|cannot convert"
    17  )
    18  

View as plain text