You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When moving from version 2.0.1 to 2.2.1, compiled using both visual studio 2015 and 2019, I encountered an error
Run-Time Check Failure #0 - The value of ESP was not properly
saved across a function call. This is usually a result of
calling a function declared with one calling convention with
a function pointer declared with a different calling convention.
in code that had virtual inheritance. Here is a simplified example that illustrates the issue:
struct A0 {
virtual int size() const = 0;
int non_virtual() const { return 2; }
};
struct A1 : public virtual A0 {
int size() const { return 1; }
};
inline void A_test(const A0& a) {
std::cout << a.non_virtual() << std::endl;
std::cout << a.size() << std::endl;
}
It seems I just need to change
class_<A1, A0>(m, "A1")
to
class_<A1, A0>(m, "A1", multiple_inheritance())
even though the eventual class that uses multiple inheritance is not wrapped.
I'm not sure why it worked in 2.0.1.
Regards,
jcr
Activity
jcpryan commentedon Jan 16, 2020
It seems I just need to change
class_<A1, A0>(m, "A1")
to
class_<A1, A0>(m, "A1", multiple_inheritance())
even though the eventual class that uses multiple inheritance is not wrapped.
I'm not sure why it worked in 2.0.1.
Regards,
jcr
bstaletic commentedon Jul 12, 2020
Seems like this issue is resolved. @jcpryan Thanks for providing the answer.