Unverified Commit 81af404b authored by Milo Yip's avatar Milo Yip Committed by GitHub

Merge pull request #1284 from mobileben/noexcept-assert

Handle non-throwing exception specifications that can still throw #1280
parents 73063f50 5b0610a7
......@@ -629,7 +629,7 @@ public:
kNullFlag, kFalseFlag, kTrueFlag, kObjectFlag, kArrayFlag, kShortStringFlag,
kNumberAnyFlag
};
RAPIDJSON_ASSERT(type >= kNullType && type <= kNumberType);
RAPIDJSON_NOEXCEPT_ASSERT(type >= kNullType && type <= kNumberType);
data_.f.flags = defaultFlags[type];
// Use ShortString to store empty string.
......@@ -831,9 +831,10 @@ public:
/*! \param rhs Source of the assignment. It will become a null value after assignment.
*/
GenericValue& operator=(GenericValue& rhs) RAPIDJSON_NOEXCEPT {
RAPIDJSON_ASSERT(this != &rhs);
this->~GenericValue();
RawAssign(rhs);
if (this != &rhs) {
this->~GenericValue();
RawAssign(rhs);
}
return *this;
}
......
......@@ -593,6 +593,19 @@ RAPIDJSON_NAMESPACE_END
//!@endcond
///////////////////////////////////////////////////////////////////////////////
// RAPIDJSON_NOEXCEPT_ASSERT
#ifdef RAPIDJSON_ASSERT_THROWS
#if RAPIDJSON_HAS_CXX11_NOEXCEPT
#define RAPIDJSON_NOEXCEPT_ASSERT(x)
#else
#define RAPIDJSON_NOEXCEPT_ASSERT(x) RAPIDJSON_ASSERT(x)
#endif // RAPIDJSON_HAS_CXX11_NOEXCEPT
#else
#define RAPIDJSON_NOEXCEPT_ASSERT(x) RAPIDJSON_ASSERT(x)
#endif // RAPIDJSON_ASSERT_THROWS
///////////////////////////////////////////////////////////////////////////////
// new/delete
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment