Skip to content

Parser parses unary operator on member of structs incorrectly #46

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

Open
abcdehello opened this issue Mar 4, 2025 · 1 comment
Open

Comments

@abcdehello
Copy link

It seems like the parser will incorrectly parse statements of a unary operator applied on a member variable of a struct as a binomial expression instead.

Example:

#include <iostream>
struct{
    int a;
    int c[5];
}b;
int main(){
    b.a++;
    b.c[0]++;
}

The expression b.a++ is parsed as a binary expression with operator . with terms b and a++ instead of a unary expression of ++ on b.a, which seems to be a mistake. The same goes for b.c[0]++.

Is it possible to issue a fix on this? Thanks!

@satya-das
Copy link
Owner

Thanks for reporting and I am already looking into it. I can see the problem myself but the possible fix I could think of is not working. So, it looks like it will take some time.

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

No branches or pull requests

2 participants