From: Robert Griesemer
Date: Mon, 22 Nov 2021 20:33:11 +0000 (-0800)
Subject: doc/go1.18: document new overflow error for some untyped arguments to print/ln
X-Git-Tag: go1.18beta1~207
X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=7456b948532e752c0ea0ac98e56e6898271f4dcd;p=gostls13.git
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
---
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