mirror of
https://github.com/golang/go
synced 2024-11-11 23:40:22 -07:00
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 <gri@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
7fbe2f4cc8
commit
7456b94853
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user