-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: internal error converting slice of non-predeclared bytes to string #47322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Interesting. I actually thought that was valid Go. gccgo accepts it. |
It should be valid Go. This is the current status of slice of bytes to string and string to slice of bytes conversions:
|
I think this is specific to |
Go spec allows:
It's also consistent with conversion rule:
|
Hmm, so the problem seems that This program compile ok with
|
Similar problem exists with slice or runes to string conversions
But this time the error is in the call to As for the slice of bytes, the error occurs only in function bodies. |
@gazerro Yes, I think they have the same root cause, for either In case of the global variables, the compiler don't generate code to runtime functions, that's why it's ok. I think this violates the Go spec, since when |
In this case all these conversions should not be valid for Go spec
Note that this program currently compiles. |
Related: #23814. |
Closed as duplicated of #23814 |
|
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
go build
What did you expect to see?
No error.
What did you see instead?
With go tip the error is the same, and with Go 1.14.15 the error is
The text was updated successfully, but these errors were encountered: