Description
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!