Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[BUG] Method followed by inheritance crashes cppfront #1382

Open
threeifbyair opened this issue Mar 29, 2025 · 0 comments
Open

[BUG] Method followed by inheritance crashes cppfront #1382

threeifbyair opened this issue Mar 29, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@threeifbyair
Copy link

Describe the bug
I've been finding little subtle bugs in cppfront by fuzzing, and I have a number of little subtle fixes that I'm going to put in a PR once I have more of them, but this one is trickier and I don't really know what the best fix is, so I'm submitting it as a bug and would love to hear suggestions!

To Reproduce

crash_m0b: type = {
}

crash_m0c: type = {
  name: i32;
  get_name: (this) -> i32 = { return name; }
  this: crash_m0b;
}

When lowering to cpp1, any data members (like name) of a type that are listed before its superclass get moved into a little class of their own, and that class becomes another superclass of the type. But any functions listed before the superclass (like get_name) just cause cppfront to segfault.

I think the right thing to do is to do a semantic analysis pass and outlaw functions listed before a superclass, but I'm not certain and I'd love to hear better ideas!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant