You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"{}"_format(UUID()) failed to compile under GCC 8.2.0 (Ubuntu 18.04.2 x64) for user classe with ostream friend operator (VS 2017 is ok):
// Compiles fine!
fmt::format("{}", UUID());
// error: ‘struct fmt::v5::formatter<CppCommon::UUID, char, void>’ has no member named ‘parse’
"{}"_format(UUID());
fmt/format.h:2140:12: error: ‘struct fmt::v5::formatter<UUID, char, void>’ has no member named ‘parse’
return f.parse(ctx);
~~^~~~~
where UUID is my custom class with ostream operator:
class UUID
{
public:
UUID() : _data() { _data.fill(0); }
explicit UUID(const std::string& uuid);
explicit UUID(const std::array<uint8_t, 16>& data) : _data(data) {}
UUID(const UUID&) = default;
UUID(UUID&&) noexcept = default;
~UUID() = default;
UUID& operator=(const std::string& uuid)
{ _data = UUID(uuid).data(); return *this; }
UUID& operator=(const std::array<uint8_t, 16>& data)
{ _data = data; return *this; }
UUID& operator=(const UUID&) = default;
UUID& operator=(UUID&&) noexcept = default;
//! Get string from the current UUID in format "00000000-0000-0000-0000-000000000000"
std::string string() const;
//! Output instance into the given output stream
friend std::ostream& operator<<(std::ostream& os, const UUID& uuid)
{ os << uuid.string(); return os; }
private:
std::array<uint8_t, 16> _data;
};
The text was updated successfully, but these errors were encountered:
chronoxor
changed the title
error: ‘struct fmt::v5::formatter<CppCommon::UUID, char, void>’ has no member named ‘parse’
error: ‘struct fmt::v5::formatter<UUID, char, void>’ has no member named ‘parse’
Mar 19, 2019
chronoxor
changed the title
error: ‘struct fmt::v5::formatter<UUID, char, void>’ has no member named ‘parse’
Literal-based API: error: ‘struct fmt::v5::formatter<UUID, char, void>’ has no member named ‘parse’
Mar 19, 2019
Thanks for reporting. This is an unfortunate side effect of the fix to #952. Need to plug in the fallback formatter that implements operator<< support into the compile-time check machinery.
"{}"_format(UUID()) failed to compile under GCC 8.2.0 (Ubuntu 18.04.2 x64) for user classe with ostream friend operator (VS 2017 is ok):
where UUID is my custom class with ostream operator:
The text was updated successfully, but these errors were encountered: