From 7456b948532e752c0ea0ac98e56e6898271f4dcd Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Mon, 22 Nov 2021 12:33:11 -0800 Subject: [PATCH] doc/go1.18: document new overflow error for some untyped arguments to print/ln Fixes #49216. For #47694. Change-Id: Ib129d790c382ddcc9677d87db4ca827b7159856a Reviewed-on: https://go-review.googlesource.com/c/go/+/366275 Trust: Robert Griesemer Reviewed-by: Ian Lance Taylor --- doc/go1.18.html | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/doc/go1.18.html b/doc/go1.18.html index 5f94aa86c4..4175063edd 100644 --- a/doc/go1.18.html +++ b/doc/go1.18.html @@ -43,6 +43,19 @@ Do not send CLs removing the interior tags from such phrases. programs is likely very small.

+

+ The Go 1.18 compiler now reports an overflow when passing a rune constant expression + such as '1' << 32 as an argument to the predeclared functions + print and println, consistent with the behavior of + user-defined functions. Before Go 1.18, the compiler did not report an error + in such cases but silently accepted such constant arguments if they fit into an + int64. As a result of this change, (possibly incorrect) programs + may not compile anymore. The necessary fix is straightforward: fix the program if it + was in fact incorrect, or explicitly convert the offending argument to the correct type. + Since go vet always pointed out this error, the number of affected + programs is likely very small. +

+

Generics