This commit is contained in:
bluehero
2017-08-07 11:58:37 +08:00
parent 5fb06596a9
commit c831675026
2 changed files with 5 additions and 22 deletions

View File

@@ -659,28 +659,13 @@ TYPED_TEST(DocumentMove, MoveAssignmentStack) {
#endif // RAPIDJSON_HAS_CXX11_RVALUE_REFS
// Issue 22: Memory corruption via operator= from Document
// Issue 22: Memory corruption via operator=
// Fixed by making unimplemented assignment operator private.
// Prohibit assignment from Document.
// But allow assignment from ValueType/int/double/..., like a ValueType
TEST(Document, Assignment) {
//TEST(Document, Assignment) {
// Document d1;
// Document d2;
// d1 = d2;
Document d;
Value x(1234);
d = x;
EXPECT_TRUE(x.IsNull()); // move semantic
EXPECT_EQ(1234, d.GetInt());
d = 1;
EXPECT_EQ(1, d.GetInt());
d = 12.34;
EXPECT_NEAR(12.34, d.GetDouble(), 0.0);
}
//}
#ifdef __clang__
RAPIDJSON_DIAG_POP