From fa27e36717ec18d64b7ff7bba71b8f0c202ba31d Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Thu, 19 Dec 2024 13:01:57 +0100 Subject: [PATCH] test: Fix broken span_tests * The comment is wrong claiming that void* was returned when void was returned in reality. * The namespace is missing a name, leading to compile errors that are suppressed with non-standard pragmas, and leading to compile errors in future commits. Instead of using more non-standard suppressions, just add the missing name. * The SpanableYes/No types are missing begin/end iterators, which will be needed when using std::span. --- src/test/span_tests.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/test/span_tests.cpp b/src/test/span_tests.cpp index aae61990f7..5a0348e77c 100644 --- a/src/test/span_tests.cpp +++ b/src/test/span_tests.cpp @@ -9,7 +9,7 @@ #include #include -namespace { +namespace spannable { struct Ignore { template Ignore(T&&) {} @@ -24,25 +24,21 @@ bool Spannable(Ignore) return false; } -#if defined(__clang__) -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wunneeded-member-function" -# pragma clang diagnostic ignored "-Wunused-member-function" -#endif struct SpannableYes { int* data(); + int* begin(); + int* end(); size_t size(); }; struct SpannableNo { - void* data(); + void data(); size_t size(); }; -#if defined(__clang__) -# pragma clang diagnostic pop -#endif -} // namespace +} // namespace spannable + +using namespace spannable; BOOST_AUTO_TEST_SUITE(span_tests) @@ -54,7 +50,7 @@ BOOST_AUTO_TEST_SUITE(span_tests) // // Previously there was a bug where writing a SFINAE check for vector was // not possible, because in libstdc++ vector has a data() member -// returning void*, and the Span template guide ignored the data() return value, +// returning void, and the Span template guide ignored the data() return value, // so the template substitution would succeed, but the constructor would fail, // resulting in a fatal compile error, rather than a SFINAE error that could be // handled.