-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[MSVC][permissive-] ranges.h(395,41): error C2672: 'get': no matching overloaded function found #2401
Comments
I don't have a Windows machine at hand to investigate this but a PR with a workaround would be welcome. |
@vitaut Thanks, I can help with testing. And you say "workaround", do you think this is a complier issue? If so, I will confirm with them. |
I am not sure but since it only happens on MSVC and specific configuration it's quite likely. |
ranges.h needs std::get overloads from <tuple> but does not directly include it. This causes compilation failures in MSVC with /permissive-. On other platforms <tuple> is included as a dependency from other headers (specifically from <memory>), but there is no such implicit dependency in MSVC's STL. Fixes fmtlib#2401
This is due to differences in implicit dependencies in the standard template libraries. ranges.h needs |
This replaces the `std::get` call with an unqualified equivalent to allow it to be treated as a dependent call. ranges.h needs std::get overloads from `<tuple>` but does not directly include it. This causes compilation failures in MSVC with /permissive-. On other platforms `<tuple>` is included as a dependency from other headers (specifically from `<memory>`), but there is no such implicit dependency in MSVC's STL. Fixes fmtlib#2401
This replaces the `std::get` call with an unqualified equivalent to allow it to be treated as a dependent call. ranges.h needs std::get overloads from `<tuple>` but does not directly include it. This causes compilation failures in MSVC with /permissive-. On other platforms `<tuple>` is included as a dependency from other headers (specifically from `<memory>`), but there is no such implicit dependency in MSVC's STL. Fixes #2401
Hi vitaut,
Tried to build fmt with /permissive- on MSVC and found the follow error, can you help look? Thanks!
Repro steps:
Repro command line:
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30037\bin\HostX64\x86\CL.exe" /c /IE:\fmt\include /IE:\fmt\test\gtest. /nologo /W1 /WX- /diagnostics:column /O2 /Ob2 /Oy- /D WIN32 /D _WINDOWS /D NDEBUG /D GTEST_HAS_STD_WSTRING=1 /D _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING=1 /D FMT_LOCALE /D "CMAKE_INTDIR="Release"" /D _MBCS /Gm- /EHsc /MD /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /external:env:EXTERNAL_INCLUDE /external:W1 /Gd /TP /analyze- /errorReport:queue "E:\fmt\test\ranges-test.cc" /permissive-
build.log
Error info:
F:\gitP\fmtlib\fmt.git\include\fmt/ranges.h(395,41): error C2672: 'get': no matching overloaded function found [F:\gitP\fmtlib\fmt.git\build_x86\test\ranges-test.vcxproj]
F:\gitP\fmtlib\fmt.git\include\fmt/ranges.h(394,1): error C2784: 'tuple_element<_Idx,std::pair<_Ty1,_Ty2>>::type &std::get(std::pair<_Ty1,_Ty2> &) noexcept': could not deduce template argument for 'std::pair<_Ty1,_Ty2> &' from 'const std::tuple' [F:\gitP\fmtlib\fmt.git\build_x86\test\ranges-test.vcxproj]
F:\gitP\fmtlib\fmt.git\include\fmt/ranges.h(394,1): error C2784: 'tuple_element<_Idx,std::pair<_Ty1,_Ty2>>::type &std::get(std::pair<_Ty1,_Ty2> &) noexcept': could not deduce template argument for 'std::pair<_Ty1,_Ty2> &' from 'const std::tuple<char,int &>' [F:\gitP\fmtlib\fmt.git\build_x86\test\ranges-test.vcxproj]
F:\gitP\fmtlib\fmt.git\include\fmt/ranges.h(394,1): error C2784: 'tuple_element<_Idx,std::pair<_Ty1,_Ty2>>::type &std::get(std::pair<_Ty1,_Ty2> &) noexcept': could not deduce template argument for 'std::pair<_Ty1,_Ty2> &' from 'const std::tuple<char,int,float>' [F:\gitP\fmtlib\fmt.git\build_x86\test\ranges-test.vcxproj]
The text was updated successfully, but these errors were encountered: