Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
this PR prevents that
ObjectWrap::Unwrap
can be used with any type. It has to be a type havingObjectWrap<T>
as sub class.I spend some time finding a bug in my appliction, which did not segfault, because I did something like this test/objectwrap-saferunwrap.cc and it compiles and the reason I found out something is really going wrong is, that the stacktrace shows calling a method
->A()
actually called->B()
. Then I realized, that it might be is a vtable pointer fixup problem and understand that of course it's possible, but not allowed to reinterpret castvoid *
to any type but the the original one.So to prevent that s.o. tries to seductively unwrap an
ObjectWrap<Car>
orObjectWrap<Truck>
to any sub class likeIVehicle
(which obviously is not a ObjectWrap) it should not compile.What do you think?
If this has a chance to land, we my need "should not compile" tests.