Commit 614b02d2 authored by Robert Griesemer's avatar Robert Griesemer

spec: clarify language about unary operator &

A composite literal may be parenthesized when
used as operand for the unary operator &.

R=rsc, iant, r, ken
CC=golang-dev
https://golang.org/cl/6996053
parent cf77dd37
<!--{ <!--{
"Title": "The Go Programming Language Specification", "Title": "The Go Programming Language Specification",
"Subtitle": "Version of December 12, 2012", "Subtitle": "Version of January 2, 2013",
"Path": "/ref/spec" "Path": "/ref/spec"
}--> }-->
...@@ -3246,6 +3246,7 @@ that is, either a variable, pointer indirection, or slice indexing ...@@ -3246,6 +3246,7 @@ that is, either a variable, pointer indirection, or slice indexing
operation; or a field selector of an addressable struct operand; operation; or a field selector of an addressable struct operand;
or an array indexing operation of an addressable array. or an array indexing operation of an addressable array.
As an exception to the addressability requirement, <code>x</code> may also be a As an exception to the addressability requirement, <code>x</code> may also be a
(possibly parenthesized)
<a href="#Composite_literals">composite literal</a>. <a href="#Composite_literals">composite literal</a>.
</p> </p>
<p> <p>
...@@ -3259,6 +3260,7 @@ will cause a <a href="#Run_time_panics">run-time panic</a>. ...@@ -3259,6 +3260,7 @@ will cause a <a href="#Run_time_panics">run-time panic</a>.
<pre> <pre>
&amp;x &amp;x
&amp;a[f(2)] &amp;a[f(2)]
&amp;Point{2, 3}
*p *p
*pf(x) *pf(x)
</pre> </pre>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment