Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCC 9.4.0 compilation error #4320

Closed
sergiud opened this issue Jan 20, 2025 · 1 comment
Closed

GCC 9.4.0 compilation error #4320

sergiud opened this issue Jan 20, 2025 · 1 comment

Comments

@sergiud
Copy link
Contributor

sergiud commented Jan 20, 2025

Compiling fmt 11.1.2 on Ubuntu 20.04 with GCC 9.4.0 fails as follows:

2.949 In file included from /build/fmt/test/ostream-test.cc:10:
2.949 /build/fmt/include/fmt/format.h: In instantiation of 'constexpr decltype (ctx.out()) fmt::v11::formatter<fmt::v11::detail::std_string_view<Char>, Char>::format(fmt::v11::detail::std_string_view<Char>, FormatContext&) const [with FormatContext = fmt::v11::context; Char = char; decltype (ctx.out()) = fmt::v11::basic_appender<char>]':
2.949 /build/fmt/include/fmt/base.h:1126:54:   required by substitution of 'template<class Char, class T, class U> decltype ((fmt::v11::formatter<U, Char>().format((* p), (* ctx)), std::true_type())) fmt::v11::detail::has_formatter_impl(T*, fmt::v11::buffered_context<Char>*) [with Char = char; T = fmt::v11::detail::std_string_view<char>; U = fmt::v11::detail::std_string_view<char>]'
2.949 /build/fmt/include/fmt/base.h:1131:43:   required from 'constexpr bool fmt::v11::detail::has_formatter() [with T = fmt::v11::detail::std_string_view<char>; Char = char]'
2.949 /build/fmt/include/fmt/base.h:1187:62:   required by substitution of 'template<bool B, class T, class F> using conditional_t = typename std::conditional::type [with bool B = fmt::v11::detail::has_formatter<fmt::v11::detail::std_string_view<char>, char>(); T = fmt::v11::detail::std_string_view<char>&; F = void]'
2.949 /build/fmt/include/fmt/base.h:1187:15:   required by substitution of 'template<class T, typename std::enable_if<fmt::v11::detail::use_formatter<T, typename std::remove_const<_Tp>::type>::value, int>::type <anonymous> > static fmt::v11::conditional_t<has_formatter<T, char>(), T&, void> fmt::v11::detail::type_mapper<char>::map<T, <enumerator> >(T&) [with T = fmt::v11::detail::std_string_view<char>; typename std::enable_if<fmt::v11::detail::use_formatter<T, typename std::remove_const<_Tp>::type>::value, int>::type <anonymous> = 0]'
2.949 /build/fmt/include/fmt/base.h:1195:57:   required by substitution of 'template<class T, class Char> using is_formattable = fmt::v11::bool_constant<(! std::is_same<decltype (fmt::v11::detail::type_mapper<Char>::map(declval<typename std::conditional<std::is_void<_Tp>::value, int*, T>::type&>())), void>::value)> [with T = fmt::v11::detail::std_string_view<char>; Char = char]'
2.949 /build/fmt/test/ostream-test.cc:273:3:   required from here
2.949 /build/fmt/include/fmt/format.h:3764:43: error: no matching function for call to 'fmt::v11::formatter<fmt::v11::detail::std_string_view<char>, char, void>::format(fmt::v11::detail::std_string_view<char>&, fmt::v11::context&) const'
2.949  3764 |       return formatter<Base, Char>::format(value, ctx);             \
2.949       |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
2.949 /build/fmt/include/fmt/format.h:3775:1: note: in expansion of macro 'FMT_FORMAT_AS'
2.949  3775 | FMT_FORMAT_AS(detail::std_string_view<Char>, basic_string_view<Char>);
2.949       | ^~~~~~~~~~~~~
2.949 /build/fmt/include/fmt/format.h:3632:20: note: candidate: 'template<class FormatContext> constexpr decltype (ctx.out()) fmt::v11::detail::native_formatter<T, Char, TYPE>::format(const T&, FormatContext&) const [with FormatContext = FormatContext; T = fmt::v11::basic_string_view<char>; Char = char; fmt::v11::detail::type TYPE = fmt::v11::detail::type::string_type]'
2.949  3632 | FMT_CONSTEXPR auto native_formatter<T, Char, TYPE>::format(
2.949       |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2.949 /build/fmt/include/fmt/format.h:3632:20: note:   template argument deduction/substitution failed:
2.949 /build/fmt/include/fmt/format.h:3764:44: note:   cannot convert 'value' (type 'fmt::v11::detail::std_string_view<char>') to type 'const fmt::v11::basic_string_view<char>&'
2.949  3764 |       return formatter<Base, Char>::format(value, ctx);             \
2.949       |                                            ^~~~~
2.949 /build/fmt/include/fmt/format.h:3775:1: note: in expansion of macro 'FMT_FORMAT_AS'
2.949  3775 | FMT_FORMAT_AS(detail::std_string_view<Char>, basic_string_view<Char>);
2.949       | ^~~~~~~~~~~~~

I could bisect the issue to c59ee96.

Repro using Docker:

FROM ubuntu:focal

RUN --mount=type=cache,target=/var/cache/apt \
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
--no-install-recommends --no-install-suggests \
ca-certificates \
ccache \
cmake \
g++ \
git \
ninja-build

ENV CMAKE_CXX_COMPILER_LAUNCHER=/usr/bin/ccache

WORKDIR /build/

RUN git clone https://github.com/fmtlib/fmt.git -b 11.1.2 --depth=1

RUN --mount=type=cache,target=/root/.ccache,sharing=shared \
cmake -S fmt/ -B build-fmt/ \
-G Ninja \
&& cmake --build build-fmt/
@vitaut
Copy link
Contributor

vitaut commented Jan 21, 2025

Same as #4313 (already fixed).

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

Successfully merging a pull request may close this issue.

2 participants