]> Cypherpunks repositories - gostls13.git/commitdiff
doc/go1.18: document new overflow error for some untyped arguments to print/ln
authorRobert Griesemer <gri@golang.org>
Mon, 22 Nov 2021 20:33:11 +0000 (12:33 -0800)
committerRobert Griesemer <gri@golang.org>
Mon, 22 Nov 2021 22:36:03 +0000 (22:36 +0000)
Fixes #49216.
For #47694.

Change-Id: Ib129d790c382ddcc9677d87db4ca827b7159856a
Reviewed-on: https://go-review.googlesource.com/c/go/+/366275
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
doc/go1.18.html

index 5f94aa86c4141c8dd887be12759cf49cd663a2a5..4175063edd4da0c47484041761041504e576c9cd 100644 (file)
@@ -43,6 +43,19 @@ Do not send CLs removing the interior tags from such phrases.
   programs is likely very small.
 </p>
 
+<p>
+  The Go 1.18 compiler now reports an overflow when passing a rune constant expression
+  such as <code>'1' << 32</code> as an argument to the predeclared functions
+  <code>print</code> and <code>println</code>, 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
+  <code>int64</code>. 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 <code>go vet</code> always pointed out this error, the number of affected
+  programs is likely very small.
+</p>
+
 <h3 id="generics">Generics</h3>
 
 <p>