mirror of
https://github.com/nlohmann/json.git
synced 2026-07-21 19:23:03 +04:00
Fix -Wunneeded-internal-declaration for CustomSentinel in test
CustomSentinel lives in an anonymous namespace (internal linkage), and the library's parse loop only ever evaluates the iterator-first direction (it != last), so the reversed-order friend operator!= was never referenced. Clang's -Weverything flags such unused internal declarations as an error. Drop the unused overload; the used direction is enough to satisfy can_compare_ne's either-order detection. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -173,16 +173,13 @@ struct CustomSentinel
|
|||||||
{
|
{
|
||||||
const char* end_ptr;
|
const char* end_ptr;
|
||||||
|
|
||||||
// Support both directions for != comparison
|
// only the iterator-first direction (it != sentinel) is ever evaluated by
|
||||||
|
// the library's parse loop; a reversed-order overload would go unused and
|
||||||
|
// trip -Wunneeded-internal-declaration under -Weverything
|
||||||
friend bool operator!=(const char* it, const CustomSentinel& sentinel)
|
friend bool operator!=(const char* it, const CustomSentinel& sentinel)
|
||||||
{
|
{
|
||||||
return it != sentinel.end_ptr;
|
return it != sentinel.end_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend bool operator!=(const CustomSentinel& sentinel, const char* it)
|
|
||||||
{
|
|
||||||
return it != sentinel.end_ptr;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_CASE("Parse with heterogeneous iterator and sentinel types")
|
TEST_CASE("Parse with heterogeneous iterator and sentinel types")
|
||||||
|
|||||||
Reference in New Issue
Block a user