From 5d7d4a9ae6f1a6cc8dba0a23dff276a12439371e Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sun, 27 Sep 2026 18:38:52 +0200 Subject: [PATCH] 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 --- tests/src/unit-regression2.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/src/unit-regression2.cpp b/tests/src/unit-regression2.cpp index a77f12043..a6c42600e 100644 --- a/tests/src/unit-regression2.cpp +++ b/tests/src/unit-regression2.cpp @@ -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(h.d); // silence -Wunused-private-field j = "holder"; } };