Skip to content
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

warning C4291: 'void *JPH::Vec3::operator new(size_t,void *) noexcept' #1402

Closed
amerkoleci opened this issue Dec 19, 2024 · 3 comments
Closed

Comments

@amerkoleci
Copy link
Contributor

Hi,
When compliling under VS 2022 I'm getting this warning, seams caused by the new operator overload changes:

C:\alimer\alimer_cpp\Source\ThirdParty\JoltPhysics\Jolt\Core\StaticArray.h(38,29): warning C4291: 'void *JPH::Vec3::operator new(size_t,void *) noexcept': no matching operator delete found; memory will not be freed if initialization throws an exception
17>(compiling source file '../../../../Source/Alimer/Physics/Jolt/PhysicsBackend_Jolt.cpp')
17>    C:\alimer\alimer_cpp\Source\ThirdParty\JoltPhysics\Jolt\Math\Vec3.h(19,2):
17>    see declaration of 'JPH::Vec3::operator new'
17>    C:\alimer\alimer_cpp\Source\ThirdParty\JoltPhysics\Jolt\Core\StaticArray.h(38,29):
17>    the template instantiation context (the oldest one first) is
17>        C:\alimer\alimer_cpp\Source\ThirdParty\JoltPhysics\Jolt\Physics\Collision\ContactListener.h(34,18):
17>        see reference to class template instantiation 'JPH::StaticArray<JPH::Vec3,64>' being compiled
17>        C:\alimer\alimer_cpp\Source\ThirdParty\JoltPhysics\Jolt\Core\StaticArray.h(34,7):
17>        while compiling class template member function 'JPH::StaticArray<JPH::Vec3,64>::StaticArray(const JPH::StaticArray<JPH::Vec3,64> &)'
17>            C:\alimer\alimer_cpp\Source\ThirdParty\JoltPhysics\Jolt\Physics\Collision\ContactListener.h(23,45):
17>            see the first reference to 'JPH::StaticArray<JPH::Vec3,64>::StaticArray' in 'JPH::ContactManifold::SwapShapes'

Gets triggered in StaticArray copy constructor (StaticArray(const StaticArray<T, N> &inRHS))

Any thoughts?

Thanks,
Amer

@amerkoleci
Copy link
Contributor Author

I fixed it by suppressing the warning in Core.h

JPH_MSVC_SUPPRESS_WARNING(4291) /* no matching operator delete found; memory will not be freed if initialization throws an exception */ \

@jrouwe
Copy link
Owner

jrouwe commented Dec 19, 2024

It seems I forgot the placement delete operators. Unfortunately I cannot reproduce the warning myself (am on the latest VS2022). Can you try if this fix works for you? If it doesn't, what commandline options are you compiling with?

@amerkoleci
Copy link
Contributor Author

Hi,
Yes it does, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants