Skip to content

Commit 129bb19

Browse files
doc/go1.15: mention 1.15.3 cgo restriction on empty structs
For #40954 Change-Id: I6a30aed31a16e820817f4ca5c7f591222e922946 Reviewed-on: https://go-review.googlesource.com/c/go/+/277432 Trust: Ian Lance Taylor <[email protected]> Reviewed-by: Keith Randall <[email protected]>
1 parent 685a322 commit 129bb19

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

doc/go1.15.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,19 @@ <h3 id="cgo">Cgo</h3>
397397
documentation</a> for more information.
398398
</p>
399399

400+
<p><!-- CL 250940 -->
401+
In Go 1.15.3 and later, cgo will not permit Go code to allocate an
402+
undefined struct type (a C struct defined as just <code>struct
403+
S;</code> or similar) on the stack or heap.
404+
Go code will only be permitted to use pointers to those types.
405+
Allocating an instance of such a struct and passing a pointer, or a
406+
full struct value, to C code was always unsafe and unlikely to work
407+
correctly; it is now forbidden.
408+
The fix is to either rewrite the Go code to use only pointers, or to
409+
ensure that the Go code sees the full definition of the struct by
410+
including the appropriate C header file.
411+
</p>
412+
400413
<h3 id="commonname">X.509 CommonName deprecation</h3>
401414

402415
<p><!-- CL 231379 -->

0 commit comments

Comments
 (0)