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

fmt collision with msvc's format library in the latest compiler (MSVC 19.32, c++20) #2895

Closed
odygrd opened this issue May 15, 2022 · 2 comments

Comments

@odygrd
Copy link

odygrd commented May 15, 2022

This started happening after github updated the msvc compiler 3 days ago with new images and the CI started failing ..

https://github.com/actions/virtual-environments/releases

I was also able to reproduce it locally using VS 2022 with MSVC 19.32.31328.0
using fmt 8.1.1 and /std:c++20

#include "fmt/chrono.h"
#include "fmt/format.h"
#include "fmt/ostream.h"
#include "fmt/ranges.h"
#include "fmt/args.h"
#include "fmt/xchar.h"

#include <iostream>
#include <vector>
#include <string>

int main()
{
  std::vector<std::string> test;
  std::cout << fmt::format("{}", test) << std::endl;
}

error :

  C:\PROGRA~1\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1432~1.313\bin\Hostx64\x64\cl.exe  /nologo /TP  -IC:\Users\odygr\source\repos\odygrd\quill\quill\include /DWIN32 /D_WINDOWS /W3 /GR /EHsc /MDd /Zi /Ob0 /Od /RTC1 -std:c++20 /showIncludes /Foexamples\CMakeFiles\example_multiple_handlers.dir\example_multiple_handlers.cpp.obj /Fdexamples\CMakeFiles\example_multiple_handlers.dir\ /FS -c C:\Users\odygr\source\repos\odygrd\quill\examples\example_multiple_handlers.cpp
C:\Users\odygr\source\repos\odygrd\quill\quill\include\quill\bundled\fmt\ranges.h(490): error C2668: 'fmt::v8::format_to': ambiguous call to overloaded function
  C:\Users\odygr\source\repos\odygrd\quill\quill\include\quill\bundled\fmt\core.h(3146): note: could be 'OutputIt fmt::v8::format_to<OutputIt,uint32_t&,0>(OutputIt,fmt::v8::basic_format_string<char,uint32_t &>,uint32_t &)'
          with
          [
              OutputIt=fmt::v8::appender
          ]
  C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\format(3046): note: or       '_OutputIt std::format_to<OutputIt,uint32_t&>(_OutputIt,const std::_Basic_format_string<char,uint32_t &>,uint32_t &)' [found using argument-dependent lookup]
          with
          [
              _OutputIt=fmt::v8::appender,
              OutputIt=fmt::v8::appender
          ]
  C:\Users\odygr\source\repos\odygrd\quill\quill\include\quill/bundled/fmt/ranges.h(460): note: while trying to match the argument list '(OutputIt, const char [9], uint32_t)'
          with
          [
              OutputIt=fmt::v8::appender
          ]
  C:\Users\odygr\source\repos\odygrd\quill\quill\include\quill/bundled/fmt/ranges.h(518): note: see reference to function template instantiation 'OutputIt fmt::v8::detail::write_range_entry<Char,OutputIt>(OutputIt,fmt::v8::basic_string_view<Char>)' being compiled
          with
          [
              OutputIt=fmt::v8::appender,
              Char=char
          ]
  C:\Users\odygr\source\repos\odygrd\quill\quill\include\quill/bundled/fmt/ranges.h(621): note: see reference to function template instantiation 'OutputIt fmt::v8::detail::write_range_entry<Char,OutputIt,std::basic_string<char,std::char_traits<char>,std::allocator<char>>,0>(OutputIt,const T &)' being compiled
          with
          [
              OutputIt=fmt::v8::appender,
              Char=char,
              T=std::basic_string<char,std::char_traits<char>,std::allocator<char>>
          ]
  C:\Users\odygr\source\repos\odygrd\quill\quill\include\quill\bundled\fmt\core.h(1282): note: see reference to function template instantiation 'OutputIt fmt::v8::formatter<std::vector<std::string,std::allocator<std::string>>,char,void>::format<Context,const std::vector<std::string,std::allocator<std::string>>,0>(U &,FormatContext &)' being compiled
          with
          [
              OutputIt=fmt::v8::appender,
              Context=fmt::v8::format_context,
              U=const std::vector<std::string,std::allocator<std::string>>,
              FormatContext=fmt::v8::format_context
          ]
  C:\Users\odygr\source\repos\odygrd\quill\quill\include\quill\bundled\fmt\core.h(1282): note: see reference to function template instantiation 'OutputIt fmt::v8::formatter<std::vector<std::string,std::allocator<std::string>>,char,void>::format<Context,const std::vector<std::string,std::allocator<std::string>>,0>(U &,FormatContext &)' being compiled
          with
          [
              OutputIt=fmt::v8::appender,
              Context=fmt::v8::format_context,
              U=const std::vector<std::string,std::allocator<std::string>>,
              FormatContext=fmt::v8::format_context
          ]
  C:\Users\odygr\source\repos\odygrd\quill\quill\include\quill\bundled\fmt\core.h(1265): note: see reference to function template instantiation 'void fmt::v8::detail::value<Context>::format_custom_arg<value_type,fmt::v8::formatter<std::vector<std::string,std::allocator<std::string>>,char,void>>(void *,fmt::v8::basic_format_parse_context<char,fmt::v8::detail::error_handler> &,Context &)' being compiled
          with
          [
              Context=fmt::v8::format_context
          ]
  C:\Users\odygr\source\repos\odygrd\quill\quill\include\quill\bundled\fmt\core.h(1261): note: see reference to function template instantiation 'void fmt::v8::detail::value<Context>::format_custom_arg<value_type,fmt::v8::formatter<std::vector<std::string,std::allocator<std::string>>,char,void>>(void *,fmt::v8::basic_format_parse_context<char,fmt::v8::detail::error_handler> &,Context &)' being compiled
          with
          [
              Context=fmt::v8::format_context
          ]
  C:\Users\odygr\source\repos\odygrd\quill\quill\include\quill\bundled\fmt\core.h(1731): note: see reference to function template instantiation 'fmt::v8::detail::value<Context>::value<const std::vector<std::string,std::allocator<std::string>>>(T &)' being compiled
          with
          [
              Context=fmt::v8::format_context,
              T=const std::vector<std::string,std::allocator<std::string>>
          ]
  C:\Users\odygr\source\repos\odygrd\quill\quill\include\quill\bundled\fmt\core.h(1731): note: see reference to function template instantiation 'fmt::v8::detail::value<Context>::value<const std::vector<std::string,std::allocator<std::string>>>(T &)' being compiled
          with
          [
              Context=fmt::v8::format_context,
              T=const std::vector<std::string,std::allocator<std::string>>
          ]
  C:\Users\odygr\source\repos\odygrd\quill\quill\include\quill\bundled\fmt\core.h(1849): note: see reference to function template instantiation 'fmt::v8::detail::value<Context> fmt::v8::detail::make_arg<true,Context,fmt::v8::detail::type::custom_type,std::vector<std::string,std::allocator<std::string>>&,0>(T)' being compiled
          with
          [
              Context=fmt::v8::format_context,
              T=std::vector<std::string,std::allocator<std::string>> &
          ]
  C:\Users\odygr\source\repos\odygrd\quill\quill\include\quill\bundled\fmt\core.h(1872): note: see reference to function template instantiation 'fmt::v8::format_arg_store<fmt::v8::format_context,std::vector<std::string,std::allocator<std::string>>>::format_arg_store<std::vector<std::string,std::allocator<std::string>>&>(std::vector<std::string,std::allocator<std::string>> &)' being compiled
  C:\Users\odygr\source\repos\odygrd\quill\quill\include\quill\bundled\fmt\core.h(1872): note: see reference to function template instantiation 'fmt::v8::format_arg_store<fmt::v8::format_context,std::vector<std::string,std::allocator<std::string>>>::format_arg_store<std::vector<std::string,std::allocator<std::string>>&>(std::vector<std::string,std::allocator<std::string>> &)' being compiled
  C:\Users\odygr\source\repos\odygrd\quill\quill\include\quill\bundled\fmt\core.h(3118): note: see reference to function template instantiation 'fmt::v8::format_arg_store<fmt::v8::format_context,std::vector<std::string,std::allocator<std::string>>> fmt::v8::make_format_args<fmt::v8::format_context,std::vector<std::string,std::allocator<std::string>>&>(std::vector<std::string,std::allocator<std::string>> &)' being compiled
  C:\Users\odygr\source\repos\odygrd\quill\examples\example_multiple_handlers.cpp(15): note: see reference to function template instantiation 'std::string fmt::v8::format<std::vector<std::string,std::allocator<std::string>>&>(fmt::v8::basic_format_string<char,std::vector<std::string,std::allocator<std::string>> &>,std::vector<std::string,std::allocator<std::string>> &)' being compiled
C:\Users\odygr\source\repos\odygrd\quill\quill\include\quill\bundled\fmt\ranges.h(494): error C2668: 'fmt::v8::format_to': ambiguous call to overloaded function
  C:\Users\odygr\source\repos\odygrd\quill\quill\include\quill\bundled\fmt\core.h(3146): note: could be 'OutputIt fmt::v8::format_to<OutputIt,uint32_t&,0>(OutputIt,fmt::v8::basic_format_string<char,uint32_t &>,uint32_t &)'
          with
          [
              OutputIt=fmt::v8::appender
          ]
  C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\format(3046): note: or       '_OutputIt std::format_to<OutputIt,uint32_t&>(_OutputIt,const std::_Basic_format_string<char,uint32_t &>,uint32_t &)' [found using argument-dependent lookup]
          with
          [
              _OutputIt=fmt::v8::appender,
              OutputIt=fmt::v8::appender
          ]
  C:\Users\odygr\source\repos\odygrd\quill\quill\include\quill/bundled/fmt/ranges.h(460): note: while trying to match the argument list '(OutputIt, const char [9], uint32_t)'
          with
          [
              OutputIt=fmt::v8::appender
          ]
C:\Users\odygr\source\repos\odygrd\quill\quill\include\quill\bundled\fmt\ranges.h(498): error C2668: 'fmt::v8::format_to': ambiguous call to overloaded function
  C:\Users\odygr\source\repos\odygrd\quill\quill\include\quill\bundled\fmt\core.h(3146): note: could be 'OutputIt fmt::v8::format_to<OutputIt,uint32_t&,0>(OutputIt,fmt::v8::basic_format_string<char,uint32_t &>,uint32_t &)'
          with
          [
              OutputIt=fmt::v8::appender
          ]
  C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\format(3046): note: or       '_OutputIt std::format_to<OutputIt,uint32_t&>(_OutputIt,const std::_Basic_format_string<char,uint32_t &>,uint32_t &)' [found using argument-dependent lookup]
          with
          [
              _OutputIt=fmt::v8::appender,
              OutputIt=fmt::v8::appender
          ]
  C:\Users\odygr\source\repos\odygrd\quill\quill\include\quill/bundled/fmt/ranges.h(460): note: while trying to match the argument list '(OutputIt, const char [9], uint32_t)'
          with
          [
              OutputIt=fmt::v8::appender
          ]
C:\Users\odygr\source\repos\odygrd\quill\quill\include\quill\bundled\fmt\ranges.h(504): error C2668: 'fmt::v8::format_to': ambiguous call to overloaded function
  C:\Users\odygr\source\repos\odygrd\quill\quill\include\quill\bundled\fmt\core.h(3146): note: could be 'OutputIt fmt::v8::format_to<OutputIt,unsigned char,0>(OutputIt,fmt::v8::basic_format_string<char,unsigned char>,unsigned char &&)'
          with
          [
              OutputIt=fmt::v8::appender
          ]
  C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\format(3046): note: or       '_OutputIt std::format_to<OutputIt,unsigned char>(_OutputIt,const std::_Basic_format_string<char,unsigned char>,unsigned char &&)' [found using argument-dependent lookup]
          with
          [
              _OutputIt=fmt::v8::appender,
              OutputIt=fmt::v8::appender
          ]
  C:\Users\odygr\source\repos\odygrd\quill\quill\include\quill/bundled/fmt/ranges.h(460): note: while trying to match the argument list '(OutputIt, const char [9], unsigned char)'
          with
          [
              OutputIt=fmt::v8::appender
          ]
  ninja: build stopped: subcommand failed.

Build All failed.
@odygrd odygrd changed the title 'fmt::v8::format_to': ambiguous call to overloaded function after MSVC 19.32 for c++20 'fmt::v8::format_to': ambiguous call to overloaded function (MSVC 19.32, c++20) May 15, 2022
@odygrd
Copy link
Author

odygrd commented May 15, 2022

This seems to be related to including "fmt/chrono.h"
When it is not included it compiles okay

edit:
looking further, the problem seems to be including #include <chrono> it seems that now that header is underneath including Microsoft's own implementation of format.h C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\format(3046):

https://github.com/microsoft/STL/blob/main/stl/inc/chrono#L34

@odygrd odygrd changed the title 'fmt::v8::format_to': ambiguous call to overloaded function (MSVC 19.32, c++20) fmt collision with msvc's format library in the latest compiler (MSVC 19.32, c++20) May 15, 2022
@odygrd
Copy link
Author

odygrd commented May 15, 2022

I can not reproduce this from the current master anymore.
format_to has moved from ranges.h

closing for now

@odygrd odygrd closed this as completed May 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant