X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Fformat.hpp;h=67509c275bad365ee23c2bd86ec7ab6fe44df5aa;hb=31375c424ac115fc0373237207fed795849e26ba;hp=73b363408f49cf499f326f601c1bdd0cd8835478;hpb=5bb4ff54d92e0a4520f02d08601a0c25f4d2505f;p=lttng-tools.git diff --git a/src/common/format.hpp b/src/common/format.hpp index 73b363408..67509c275 100644 --- a/src/common/format.hpp +++ b/src/common/format.hpp @@ -19,19 +19,27 @@ DIAGNOSTIC_IGNORE_DUPLICATED_BRANCHES #include DIAGNOSTIC_POP +/* + * Due to a bug in g++ < 7.1, this specialization must be enclosed in the fmt namespace, + * see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480. + */ +namespace fmt { template <> -struct fmt::formatter : fmt::formatter { - template - typename FormatCtx::iterator format(const std::type_info& type_info, FormatCtx& ctx) +struct formatter : formatter { + template + typename FormatContextType::iterator format(const std::type_info& type_info, + FormatContextType& ctx) { int status; - auto demangled_name = abi::__cxa_demangle(type_info.name(), nullptr, 0, &status); - auto it = status == 0 ? fmt::formatter::format(demangled_name, ctx) : - fmt::formatter::format(type_info.name(), ctx); + auto demangled_name = + abi::__cxa_demangle(type_info.name(), nullptr, nullptr, &status); + auto it = status == 0 ? formatter::format(demangled_name, ctx) : + formatter::format(type_info.name(), ctx); free(demangled_name); return it; } }; +} /* namespace fmt */ #endif /* LTTNG_FORMAT_H */