-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Closed
Labels
kind: bugrelease item: 🐛 bug fixsolution: proposed fixa fix for the issue has been proposed and waits for confirmationa fix for the issue has been proposed and waits for confirmation
Milestone
Description
Clang reports the following warning:
../single_include/nlohmann/json.hpp:18265:20: error: returning reference to local temporary object [-Werror,-Wreturn-stack-address]
return *ptr;
^~~~
Context:
template<typename ReferenceType, typename ThisType>
static ReferenceType get_ref_impl(ThisType& obj)
{
// delegate the call to get_ptr<>()
auto ptr = obj.template get_ptr<typename std::add_pointer<ReferenceType>::type>();
if (JSON_HEDLEY_LIKELY(ptr != nullptr))
{
return *ptr; // <----- warning
}
JSON_THROW(type_error::create(303, "incompatible ReferenceType for get_ref, actual type is " + std::string(obj.type_name())));
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
kind: bugrelease item: 🐛 bug fixsolution: proposed fixa fix for the issue has been proposed and waits for confirmationa fix for the issue has been proposed and waits for confirmation