Open mkolin opened 1 year ago
Looks like somewhere deep inside of Cling (or even Clang, to be honest) an assumption of a virtual dtor existing is being made, but Common
does not have one.
I'll see whether this is worth intercepting in the dtor call in the backend, otherwise it will have to be upstreamed, which always takes (much) longer.
Ran into this same virtual dtor crash issue while trying to update from an older cppyy (version 1.9.5)
Is there any update regarding this issue? mostly if we'll need to wait for the upstream fix
you can once try this in replit where all new version avilable
the output error of the issued snippet above is as follow
{}
*** Break *** segmentation violation
*** Break *** segmentation violation
actually, the simpler version as bellow causes the same error as well
import cppyy
cppyy.cppdef('''
#include <string>
#include <vector>
struct Common {
std::string name;
};
struct Parent : Common {
// ~Parent() {}
// using Common::name;
std::vector<Common> children;
};
''')
p = cppyy.gbl.Parent()
print(p.children)
The error can be resolved if u uncomment the destructor for Parent(). It also can work if u change struct
to class
.
Thus, the issue is not relating to the nested or same-name definition. Somehow, when both Parent and its member inherits from the same base Common, the compiler cannot destruct the resource properly.
Sorry I can't provide too many details about this one. We have a case where two nested classes of the same name, both inheriting from a common base, will crash if a user accesses a vector of one of these nested classes. If you take out the inheritance it won't crash and if you structure the nesting differently it seems like it won't crash either.
I'm using:
and here's the test script:
This particular script will crash on exit, though we have a case where simply accessing the vector will cause a crash. Any help would be appreciated. Thanks for the good work!