spec: legal conversions from string constant to byte slice are not covered by convertability rules #25991
Labels
Documentation
Issues describing a change to documentation.
NeedsFix
The path to resolution is known, but the work has not been done.
Milestone
According to Conversions (as of 21.06.2018), the following programs should be illegal, but it compiles without errors:
Here we have constant value
"s"
converted to[]byte
. According to spec,"s"
must be Representable by[]byte
. The only way to explain the absence of error is to suppose that"s"
is in the set of values determined by[]byte
.The assumption above contradicts with Assignability rules. Consider the following program that fails to compile:
So,
"s"
is not assignable to[]byte
. As a consequence,"s"
is not representable by[]byte
and"s"
is not in the set of values determined by[]byte
.The text was updated successfully, but these errors were encountered: