mirror of
https://github.com/golang/go
synced 2024-11-21 15:44:44 -07:00
spec: &x panics if x does
See golang.org/s/go12nil for the extended version. R=golang-dev, r, adonovan CC=golang-dev https://golang.org/cl/12964043
This commit is contained in:
parent
08fdf00906
commit
5ce78b7cd2
@ -3287,7 +3287,10 @@ or an array indexing operation of an addressable array.
|
||||
As an exception to the addressability requirement, <code>x</code> may also be a
|
||||
(possibly parenthesized)
|
||||
<a href="#Composite_literals">composite literal</a>.
|
||||
If the evaluation of <code>x</code> would cause a <a href="#Run_time_panics">run-time panic</a>,
|
||||
then the evaluation of <code>&x</code> does too.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
For an operand <code>x</code> of pointer type <code>*T</code>, the pointer
|
||||
indirection <code>*x</code> denotes the value of type <code>T</code> pointed
|
||||
@ -3302,6 +3305,10 @@ will cause a <a href="#Run_time_panics">run-time panic</a>.
|
||||
&Point{2, 3}
|
||||
*p
|
||||
*pf(x)
|
||||
|
||||
var x *int = nil
|
||||
*x // causes a run-time panic
|
||||
&*x // causes a run-time panic
|
||||
</pre>
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user