-
Notifications
You must be signed in to change notification settings - Fork 896
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
Struct casting not supported by LLVM, suggest+implement struct pointer casting #162
Conversation
Whoops, this needs more work: turns out struct pointers do not get casted either |
compiler/compiler.go
Outdated
"converting between struct types is not yet supported; consider converting pointers as a workaround") | ||
} | ||
case *types.Pointer: | ||
if _, ok := underlying.Elem().Underlying().(*types.Struct); ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's fine to always bitcast pointers. A superfluous bitcast is trivially optimized away, and it might make the code a bit simpler and more generic (think of double indirection for example).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
2c6ca26
to
e532de1
Compare
Hi @kyegupov I switched this branch to point to the |
9499f26
to
c04144a
Compare
@deadprogram done |
@kyegupov are you planning to fully implement this feature - that is, by extracting all values from the struct and creating a new struct with the new values? If not, I can merge this PR but will likely implement that myself. |
Sorry, I'm no longer working on the project that required tinygo, so I'm not likely to invest more effort into this. |
Closed by #258. |
A better error message for #161, to catch the problem before the LLVM verifier does.