Merge branch 'gcc10-cxx20'

Compilation fixes for g++10 in C++20 mode.

See https://github.com/wxWidgets/wxWidgets/pull/1851
This commit is contained in:
Vadim Zeitlin
2020-05-14 23:49:57 +02:00
3 changed files with 62 additions and 13 deletions

View File

@@ -55,6 +55,31 @@
#define wxDEFAULT_MANTISSA_SIZE_3
#endif
// Many tests use wide characters or wide strings inside Catch macros, which
// requires converting them to string if the check fails. This falls back to
// std::ostream::operator<<() by default, which never worked correctly, as there
// never was any overload for wchar_t and so it used something else, but in C++
// 20 this overload is explicitly deleted, so it results in compile-time error.
//
// Hence define this specialization to allow compiling such comparisons.
namespace Catch
{
template <>
struct StringMaker<wchar_t>
{
static std::string convert(wchar_t wc)
{
if ( wc < 0x7f )
return std::string(static_cast<char>(wc), 1);
return wxString::Format("U+%06X", wc).ToStdString();
}
};
} // namespace Catch
// thrown when assert fails in debug build
class TestAssertFailure
{