From f17207377b51d8c1486e75188e6abe54aa67c634 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Fri, 2 Oct 2026 11:43:28 +0200 Subject: [PATCH] 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 --- include/nlohmann/json.hpp | 2 ++ single_include/nlohmann/json.hpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index 64fb45c4c..d588dae74 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -2561,6 +2561,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec { auto ret = ValueType(); JSONSerializer::from_json(*this, ret); + // false positive: ret is returned by value, not its address + // @infer-ignore STACK_VARIABLE_ADDRESS_ESCAPE return ret; } diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index db07ff1f9..bdfb3f0c8 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -29790,6 +29790,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec { auto ret = ValueType(); JSONSerializer::from_json(*this, ret); + // false positive: ret is returned by value, not its address + // @infer-ignore STACK_VARIABLE_ADDRESS_ESCAPE return ret; }