Skip to content
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

Fixed promotion of [0] to * and -> only in specific cases #87

Merged
merged 2 commits into from
Dec 12, 2024

Conversation

AjayBrahmakshatriya
Copy link
Collaborator

Currently BuildIt promotes all operator[0] to * and ->. This is OKAY for pointers however for custom types with overloaded [0] operator actually breaks semantics. One example is std::vector, where vec[0].foo is not the same as vec->foo;

To get around this, BuildIt adds a metadata "deref_is_star" in cases where the operator[0] comes from a * or an ->
The code gen now upgrades these operators only when this metadata is present. Not promoting is always correct.

Sample33 and sample59 have been updated to test the same.

@AjayBrahmakshatriya AjayBrahmakshatriya merged commit c74cd27 into BuildIt-lang:master Dec 12, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant