mirror of
https://github.com/nlohmann/json.git
synced 2026-09-27 18:20:32 +00:00
Use the #3669 fixture's optional member in to_json
Issue3669Holder::d is never read, so clang's -Weverything -Werror build (ci_test_clang) fails with -Wunused-private-field. Reference the member in the hidden-friend to_json; this does not affect the instantiation cycle the fixture reproduces. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -280,8 +280,9 @@ class Issue3669Holder
|
||||
// GCC < 11 (C++11/14) rejects a free to_json(json&, const Issue3669Holder&)
|
||||
// here, because ADL for Issue3669Dummy finds it and closes an instantiation
|
||||
// cycle; a hidden friend is only visible to ADL for Issue3669Holder
|
||||
friend void to_json(json& j, const Issue3669Holder& /*unused*/)
|
||||
friend void to_json(json& j, const Issue3669Holder& h)
|
||||
{
|
||||
static_cast<void>(h.d); // silence -Wunused-private-field
|
||||
j = "holder";
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user