Open ArtsevDmitry opened 4 years ago
Thanks for reporting the bug.
Maybe we should not generate properties for methods, when they are virtual.
As a workaround, you can disable the pass that generates properties out of getters (GetterSetterToPropertyPass
).
@ArtsevDmitry the correct behaviour should be to only get an overridden property with the body of the generated method which in turn should be gone. Unfortunately, I couldn't reproduce it here. The macros in your test case might be somehow involved. I would advise you to try generation with gradually removed macros to see if you can get to an even simpler test case.
I ran into this bug as well and made a minimal reproduction:
namespace foo {
class Dorld {
virtual int UnkFunc1() = 0;
};
}
class Bar : public foo::Dorld {
public:
virtual int UnkFunc1() override;
};
Results in this output: https://gist.github.com/angryzor/5f00133280bce5e0cd523eb0d2562428
Note that the namespace is important. If Bar
is declared inside the same namespace the bug is not triggered. However, my original code where I encountered this bug did have both classes in the same namespace, though they were in different header files.
[EDIT] I tried debugging the issue myself but I've been unsuccessful at setting up a working dev environment, I'm sorry :(
I had another look and concluded that the bug occurs in GetterSetterToPropertyPass
: it tries to determine whether the property overrides a base property here.
When Bar
is outside the namespace Bar
gets processed before Dorld
, so Dorld
doesn't have the property created yet. The check fails and the property is not created on Bar
. The property is then later created on Dorld
when the pass finally visits Dorld
.
When instead Bar
is inside the namespace, Dorld
is visited first and the code continues as expected.
Looking to see if I can make a patch because this bug is really causing issues for me.
Ok yeah this is really simple, just need to add VisitFlags.ClassBases
I'm playing around OpenCascade simple wrapper. I use one header "Geom2d_Line.hxx", class Geom2d_Line inherited from Geom2d_Curve which contain next method:
in Geom2d_Line class this method overrides:
OS: Windows
when it converted to C#, I have property in Geom2dCurve
but in Geom2dLine I have these two members:
and this in same CS class:
There are two issues:
What should I do in this case, can I solve it with custom pass or something? Thanks.
Used headers
Geom2d_Line.hxx
Used settings
Target: MSVC