Tencent / rapidjson

A fast JSON parser/generator for C++ with both SAX/DOM style API
http://rapidjson.org/
Other
14.19k stars 3.53k forks source link

Throw exception in functions which is specified as noexcept #2243

Open EstherWx opened 9 months ago

EstherWx commented 9 months ago

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?