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

Fix offsetof not being usable with macros #7703

Merged
merged 1 commit into from
Apr 23, 2019

Conversation

malte-v
Copy link
Contributor

@malte-v malte-v commented Apr 21, 2019

This fixes #7702.

@Sija
Copy link
Contributor

Sija commented Apr 21, 2019

Some specs would nice :)

Copy link
Member

@asterite asterite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is correct.

@asterite
Copy link
Member

I say it because visitor should be respected. This is probably some issue in ToSVisitor, check that you implement that and that you return false in the method so children aren't revisited/printed.

@asterite
Copy link
Member

I can confirm that's the issue. Just add a new line at the end of the method overload for OffsetOf in ToSVisitor that says false (but please keep the test).

@asterite
Copy link
Member

Or even better, remove this test and add a test to the to s visitor.

@malte-v malte-v force-pushed the bug/7702-macros-with-offsetof branch from 9fbb4ab to ec8e276 Compare April 22, 2019 07:31
@malte-v
Copy link
Contributor Author

malte-v commented Apr 22, 2019

I just realized my "solution" breaks much more that it fixes, e.g. type aliases stopped working with offsetof.
@asterite Thank you so much! I wouldn't have noticed that small detail. That must be the proper solution.

@bcardiff bcardiff added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler labels Apr 22, 2019
@bcardiff bcardiff added this to the 0.29.0 milestone Apr 22, 2019
@asterite asterite merged commit 9888f8d into crystal-lang:master Apr 23, 2019
@malte-v malte-v deleted the bug/7702-macros-with-offsetof branch April 30, 2019 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

offsetof can't be used in macros
4 participants