mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-21 09:32:39 +02:00
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.
This commit is contained in:
parent
fadf02ef8b
commit
fa27e36717
@ -9,7 +9,7 @@
|
|||||||
#include <set>
|
#include <set>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace {
|
namespace spannable {
|
||||||
struct Ignore
|
struct Ignore
|
||||||
{
|
{
|
||||||
template<typename T> Ignore(T&&) {}
|
template<typename T> Ignore(T&&) {}
|
||||||
@ -24,25 +24,21 @@ bool Spannable(Ignore)
|
|||||||
return false;
|
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
|
struct SpannableYes
|
||||||
{
|
{
|
||||||
int* data();
|
int* data();
|
||||||
|
int* begin();
|
||||||
|
int* end();
|
||||||
size_t size();
|
size_t size();
|
||||||
};
|
};
|
||||||
struct SpannableNo
|
struct SpannableNo
|
||||||
{
|
{
|
||||||
void* data();
|
void data();
|
||||||
size_t size();
|
size_t size();
|
||||||
};
|
};
|
||||||
#if defined(__clang__)
|
} // namespace spannable
|
||||||
# pragma clang diagnostic pop
|
|
||||||
#endif
|
using namespace spannable;
|
||||||
} // namespace
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE(span_tests)
|
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<bool> was
|
// Previously there was a bug where writing a SFINAE check for vector<bool> was
|
||||||
// not possible, because in libstdc++ vector<bool> has a data() member
|
// not possible, because in libstdc++ vector<bool> 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,
|
// 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
|
// resulting in a fatal compile error, rather than a SFINAE error that could be
|
||||||
// handled.
|
// handled.
|
||||||
|
Loading…
Reference in New Issue
Block a user