diff --git a/doc/go_spec.html b/doc/go_spec.html
index 30fce856acf..f82336a85bd 100644
--- a/doc/go_spec.html
+++ b/doc/go_spec.html
@@ -528,7 +528,8 @@ A constant value is represented by an
character, or
string literal,
an identifier denoting a constant,
-a constant expression, or
+a constant expression,
+a conversion with a result that is a constant, or
the result value of some built-in functions such as
unsafe.Sizeof
applied to any value,
cap
or len
applied to
@@ -3227,8 +3228,42 @@ If the type starts with an operator it must be parenthesized:
-A value x
can be converted to type T
in any
-of these cases:
+A constant value x
can be converted to
+type T
in any of these cases:
+
x
is representable by a value of type T
.
+ x
is an integer constant and T
is a
+ string type.
+ The same rule as for non-constant x
applies in this case
+ (§Conversions to and from a string type).
+ +Converting a constant yields a typed constant as result. +
+ ++uint(iota) // iota value of type uint +float32(2.718281828) // 2.718281828 of type float32 +complex128(1) // 1.0 + 0.0i of type complex128 +string('x') // "x" of type string +string(0x266c) // "♬" of type string +MyString("foo" + "bar") // "foobar" of type MyString +string([]byte{'a'}) // not a constant: []byte{'a'} is not a constant +(*int)(nil) // not a constant: nil is not a constant, *int is not a boolean, numeric, or string type +int(1.2) // illegal: 1.2 cannot be represented as an int +string(65.0) // illegal: 65.0 is not an integer constant ++ +
+A non-constant value x
can be converted to type T
+in any of these cases:
-Specific rules apply to conversions between numeric types or to and from
-a string type.
+Specific rules apply to (non-constant) conversions between numeric types or
+to and from a string type.
These conversions may change the representation of x
and incur a run-time cost.
All other conversions only change the type but not the representation
of x
.
+There is no linguistic mechanism to convert between pointers and integers.
+The package unsafe
+implements this functionality under
+restricted circumstances.
+
+For the conversion of non-constant numeric values, the following rules apply: +
+float32(x + 0.1)
does not.
-In all conversions involving floating-point or complex values, +In all non-constant conversions involving floating-point or complex values, if the result type cannot represent the value the conversion -succeeds but the result value is -implementation-dependent. +succeeds but the result value is implementation-dependent.
-[]int(nil)
.
-There is no linguistic mechanism to convert between pointers and integers.
-The package unsafe
-implements this functionality under
-restricted circumstances.
-