|
Hello I have an interface which looks like and I have a real class which implements the There is a function which is used to create the All is great, I am able to use the interface, until I try to delete the created implementation using the function The problem is that I do not hit the Could you advice parse option, if any, which changes this behavior for a particular class? |
Replies: 10 comments 31 replies
|
I don't think there is any particular parsing option that changes this behavior, it may be a bug. Which platform is this, Linux or VS? |
|
It is Visual Studio, I can attach an entire project too. |
|
Would be worth to check in Linux then, because the vtable code is different. Also I wonder if the problem could be related to passing in a |
|
I have tried to pass the parameter of the Besides, please look at the picture, at the Watch panel. The Unfortunately, I have no Linux machine, so I am not able to check the behavior. |
|
Could you tell me if there is any advice of how to deal with the issue? Maybe there is a way of somehow rewrite the code? |
|
One thing I noticed is that: var __result0 = global::ServerStubProject.dll.IString.__GetOrCreateInstance(___ret, true);This line passes |
|
Try and compile with MSVC/cl command line, https://godbolt.org/z/93zE6KEYq, and try to dump vtable layout: https://gist.github.com/GavinRay97/700ff1631d7e5ac460efd0780759c908 |
|
You should add some breakpoints in the generator in and figure out why the code branch that generates the call to the native dtor is not getting hit. |
|
According to: Trivial destructor
Then I think since the destructor is virtual, it should not be trivial, and that should be set indeed. |
|
I think the issue here is that we can't know the lifetime of the returned pointer, maybe that's why we end up copying it, but then we should also be freeing it. It's been a few years since I really touched this, so I'd have to think carefully what's going on and what needs to be done to fix it. |







According to:
Trivial destructor
The destructor for class T is trivial if all of the following is true: