diff --git a/include/Void/Core/Meta.hpp b/include/Void/Core/Meta.hpp index 660edeb..4c9f84f 100644 --- a/include/Void/Core/Meta.hpp +++ b/include/Void/Core/Meta.hpp @@ -253,7 +253,9 @@ namespace Void::Meta out += "?"; } out += '{'; - bool first = true; + // Reflectable types with no members (e.g. std::optional) leave this + // unread; the diagnostic is about a deliberately empty loop body. + [[maybe_unused]] bool first = true; template for (constexpr auto m : members_v) { if (!first) { diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index c2653f6..6ab97e2 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -114,6 +114,18 @@ endforeach() if(_all_generated) add_executable(VoidTests ${_all_generated}) + # The generated test translation units belong to VoidTests, not to a module + # target, so the warnings-as-errors policy from void_add_module does not + # reach them unless it is applied here explicitly (X-QA-01). + if(VOID_WARNINGS_AS_ERRORS) + target_compile_options(VoidTests PRIVATE + "$<$:$<$:-Wall;-Wextra;-Wpedantic;-Werror;-Wno-missing-field-initializers>>" + # Test helpers live in anonymous namespaces and are captured by + # coroutine frames; GCC's subobject-linkage diagnostic is noise for + # that pattern, not a defect in the test code. + "$<$:$<$:-Wno-subobject-linkage>>") + endif() + # Disable auto-sweep: we already applied the scanner manually above. set_target_properties(VoidTests PROPERTIES VOID_TESTING_NO_AUTO_SCAN TRUE) diff --git a/tests/standalone/Time/Bench.cpp b/tests/standalone/Time/Bench.cpp index 867d771..101b53e 100644 --- a/tests/standalone/Time/Bench.cpp +++ b/tests/standalone/Time/Bench.cpp @@ -35,6 +35,7 @@ Void::Testing::Test bench_run_total_positive() const auto r = run("work", 100, [] { volatile int x = 0; for (int i = 0; i < 100; ++i) x += i; + do_not_optimize(x); }, 0); Void::Testing::expect(r.total.count() >= 0); }