Workaround an issue with mixing std versions in gcc (#2017)

This commit is contained in:
Victor Zverovich
2020-11-14 09:02:14 -08:00
parent a57baa69a5
commit df66516ed3
2 changed files with 7 additions and 14 deletions

View File

@@ -2423,17 +2423,17 @@ TEST(FormatTest, CharTraitsIsNotAmbiguous) {
#endif
}
#if __cplusplus > 201103L
struct custom_char {
int value;
custom_char() = default;
template <typename T> custom_char(T val) : value(static_cast<int>(val)) {}
template <typename T>
constexpr custom_char(T val) : value(static_cast<int>(val)) {}
operator int() const { return value; }
};
int to_ascii(custom_char c) { return c; }
FMT_BEGIN_NAMESPACE
template <> struct is_char<custom_char> : std::true_type {};
FMT_END_NAMESPACE
@@ -2444,6 +2444,7 @@ TEST(FormatTest, FormatCustomChar) {
EXPECT_EQ(result.size(), 1);
EXPECT_EQ(result[0], custom_char('x'));
}
#endif
// Convert a char8_t string to std::string. Otherwise GTest will insist on
// inserting `char8_t` NTBS into a `char` stream which is disabled by P1423.