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:
Niels Lohmann
2026-10-02 11:43:28 +02:00
parent 3b30446d1b
commit f17207377b
2 changed files with 4 additions and 0 deletions
+2
View File
@@ -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;
}
+2
View File
@@ -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;
}