-
Notifications
You must be signed in to change notification settings - Fork 572
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
infinite recursion when calling virtualized inherited function #723
Comments
It won't work if class D isn't Virtual as well, yes, that's expected. |
Actually, that probably wouldn't work either. That sounds like the kind of thing your Info.upcast is supposed to solve... |
|
A workaround, as long as we don't need infoMap.put(new Info("B::f").annotations("@Virtual(subclasses=false)") This prevents the |
This triggers an infinite recursion:
d.f
is called.f
is not overridden in Java, so JavaB.f
is calledJava_B_f
is called. SinceB
is virtualized, instead of calling C++B::f
, the object is checked whether if's an instance of the peer classJavaCPP_B
. It's not the case, the object is aJavaCPP_D
, andJavaCPP_D
doesn't derive fromJavaCPP_B
. Sof
is called on the object, that isJavaCPP_D::f
.JavaCPP_D::f
calls Javad.f
.How to solve this ?
Shouldn't
JavaCPP_D
derives fromJavaCPP_B
in addition of deriving fromD
?Or should we call explicity
B::f
and bypass dynamic invocation at the end of 2. ?The text was updated successfully, but these errors were encountered: