Skip to content

Commit

Permalink
doc/go1.18: document new overflow error for some untyped arguments to…
Browse files Browse the repository at this point in the history
… print/ln

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>
  • Loading branch information
griesemer committed Nov 22, 2021
1 parent 7fbe2f4 commit 7456b94
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions doc/go1.18.html
Expand Up @@ -43,6 +43,19 @@ <h3 id="bug_fixes">Bug fixes</h3>
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>
Expand Down

0 comments on commit 7456b94

Please sign in to comment.