go/test/fixedbugs/issue19947.go
Alberto Donizetti 2e60882fc7 cmd/compile: do not print duplicate error on ideal->float{32,64} overflow
Also adjust truncfltlit to make it more similar to trunccmplxlit, and
make it report an error for bad Etypes.

Fixes #19947

Change-Id: I6684523e989c2293b8a8e85bd2bfb9c399c5ea36
Reviewed-on: https://go-review.googlesource.com/40453
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-04-12 21:00:15 +00:00

16 lines
564 B
Go

// errorcheck
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// No double error on ideal -> float{32,64} conversion overflow
package issue19947
var _ = float32(1) * 1e200 // ERROR "constant 1e\+200 overflows float32"
var _ = float64(1) * 1e500 // ERROR "constant 1e\+500 overflows float64"
var _ = complex64(1) * 1e200 // ERROR "constant 1e\+200 overflows complex64"
var _ = complex128(1) * 1e500 // ERROR "constant 1e\+500 overflows complex128"