Skip to content

g++-10 compilation error when including fmt/ostream.h #2479

Description

@MichaelTrikergiotis

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]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions