You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package structconvert
type (
A1struct {
MemberB1
}
A2struct {
MemberB2
}
B1struct {
Switchbool
}
B2struct {
Switchbool
}
)
funcConvert() {
_=B2(B1{}) // ok_=A2(A1{}) // not ok
}
What did you expect to see?
I expected the code to compile. I raised as a bug, but perhaps it is intentional that struct type conversion doesn't recursively evaluate struct equivalence? I'm not sure why it shouldn't though.
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?
What did you expect to see?
I expected the code to compile. I raised as a bug, but perhaps it is intentional that struct type conversion doesn't recursively evaluate struct equivalence? I'm not sure why it shouldn't though.
Related: #19778
What did you see instead?
Compilation error:
cannot convert A1{} (value of type A1) to type A2
The text was updated successfully, but these errors were encountered: