mirror of
https://github.com/nlohmann/json.git
synced 2026-10-03 05:00:30 +00:00
Mark an Infer false positive in get_impl()
The tests added here instantiate basic_json::get() with a type for which Infer 1.3.0 reports STACK_VARIABLE_ADDRESS_ESCAPE on "return ret;", although ret is returned by value. Suppress it on that line, as develop does for its own Infer false positives (#5750). Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -2561,6 +2561,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
|
||||
{
|
||||
auto ret = ValueType();
|
||||
JSONSerializer<ValueType>::from_json(*this, ret);
|
||||
// false positive: ret is returned by value, not its address
|
||||
// @infer-ignore STACK_VARIABLE_ADDRESS_ESCAPE
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -29790,6 +29790,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
|
||||
{
|
||||
auto ret = ValueType();
|
||||
JSONSerializer<ValueType>::from_json(*this, ret);
|
||||
// false positive: ret is returned by value, not its address
|
||||
// @infer-ignore STACK_VARIABLE_ADDRESS_ESCAPE
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user