未验证 提交 7a6e28ac 编写于 作者: F Florian Albrechtskirchinger 提交者: GitHub

Add assertion to converting constructor (#3517)

The converting basic_json constructor can inadvertently change the value
type of its parameter. Assert that both basic_json values are of the
same value type after conversion.
上级 560cede0
......@@ -916,6 +916,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
default: // LCOV_EXCL_LINE
JSON_ASSERT(false); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert) LCOV_EXCL_LINE
}
JSON_ASSERT(m_type == val.type());
set_parents();
assert_invariant();
}
......
......@@ -19190,6 +19190,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
default: // LCOV_EXCL_LINE
JSON_ASSERT(false); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert) LCOV_EXCL_LINE
}
JSON_ASSERT(m_type == val.type());
set_parents();
assert_invariant();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册