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

Throw exception in functions which is specified as noexcept #2243

Open
EstherWx opened this issue Dec 22, 2023 · 0 comments
Open

Throw exception in functions which is specified as noexcept #2243

EstherWx opened this issue Dec 22, 2023 · 0 comments

Comments

@EstherWx
Copy link
Contributor

When a function is specified noexcept , the compiler does not generate any code to throw exceptions and any uncaught exception will result in a call to std::terminate.

in allocator.h, ~MemoryPoolAllocator() is specified noexcept, but it calls delete, which will throw exception.
~MemoryPoolAllocator() RAPIDJSON_NOEXCEPT {
...
RAPIDJSON_DELETE(a);
}
#define RAPIDJSON_DELETE(x) delete x

And MemoryPoolAllocator& operator=(), too.

Is it intentional to do so?
Could we move "RAPIDJSON_NOEXCEPT" here?

@EstherWx EstherWx changed the title Throw exception in functions which is specified noexcept Throw exception in functions which is specified as noexcept Dec 25, 2023
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

1 participant