Including the fmt/ostream.h header when using g++-10 with -std=c++20, stops compilation with an error.
The issue doesn't exist with clang 12 or the latest MSVC.
compiler : g++ 10.3.0 with -std=c++20
OS : Ubuntu 21.04
fmt : 8.0.1
The issue also exists in fmt 8.0.
This issue doesn't exist in fmt 7.1.3.
Working example :
#define FMT_HEADER_ONLY
#include "fmt/core.h"
int main()
{
fmt::print("Works.\n");
}
The above compiled with g++-10 -std=c++20 with no problems.
Not working example, with link to godbolt : https://gcc.godbolt.org/z/7n6hPsdj8 :
#define FMT_HEADER_ONLY
#include "fmt/core.h"
#include "fmt/ostream.h"
int main()
{
fmt::print("Doesn't work.\n");
}
Trying to compile with g++-10 -std=c++20 :
In file included from bad.cpp:3:
fmt/ostream.h:123:8: error: partial specialization of ‘struct fmt::v8::detail::fallback_formatter<T, Char, typename std::enable_if<fmt::v8::detail::is_streamable<T, Char>::value, void>::type>’ after instantiation of ‘struct fmt::v8::detail::fallback_formatter<char [7], char, void>’ [-fpermissive]
123 | struct fallback_formatter<T, Char, enable_if_t<is_streamable<T, Char>::value>>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fmt/ostream.h:123:8: error: partial specialization of ‘struct fmt::v8::detail::fallback_formatter<T, Char, typename std::enable_if<fmt::v8::detail::is_streamable<T, Char>::value, void>::type>’ after instantiation of ‘struct fmt::v8::detail::fallback_formatter<char [3], char, void>’ [-fpermissive]
fmt/ostream.h:123:8: error: partial specialization of ‘struct fmt::v8::detail::fallback_formatter<T, Char, typename std::enable_if<fmt::v8::detail::is_streamable<T, Char>::value, void>::type>’ after instantiation of ‘struct fmt::v8::detail::fallback_formatter<char [1], char, void>’ [-fpermissive]
Including the
fmt/ostream.hheader when usingg++-10with-std=c++20, stops compilation with an error.The issue doesn't exist with
clang 12or the latestMSVC.compiler :
g++ 10.3.0with-std=c++20OS :
Ubuntu 21.04fmt :
8.0.1The issue also exists in
fmt 8.0.This issue doesn't exist in
fmt 7.1.3.Working example :
The above compiled with
g++-10 -std=c++20with no problems.Not working example, with link to godbolt : https://gcc.godbolt.org/z/7n6hPsdj8 :
Trying to compile with
g++-10 -std=c++20: