ericniebler / range-v3

Range library for C++14/17/20, basis for C++20's std::ranges
Other
4.12k stars 439 forks source link

Range-v3 failed to build due to error C2220: warning C4180 is treated as an error with MSVC on windows #1334

Open spacelg opened 5 years ago

spacelg commented 5 years ago

Environment: Windows Server 2016 + VS2017 + Range-v3 master branch latest srouce code.

Range-v3 failed to build due to error C2220: warning C4180 is treated as an error with MSVC on windows . It can be first reproduced on master revision f914dd7. Could you help have a look about this issue? Thanks in advance!

Steps to reproduce the behavior: 1.git clone https://github.com/ericniebler/range-v3 D:\Range-v3\src 2.Open a VS 2017 x86 command prompt as admin and browse to D:\Range-v3 3.mkdir build_x86 && pushd build_x86 4.cmake -G "Visual Studio 15 2017" -DCMAKE_SYSTEM_VERSION=10.0.17134.0 -DCMAKE_BUILD_TYPE=Release ..\src 5.pop 6.pushd build_x86 7.msbuild Range-v3.sln /p:Configuration=Release /p:Platform=win32 /m /t:Rebuild

log_x86_build.log

Actual result:

D:\Range-v3\src\include\concepts/type_traits.hpp(167): error C2220: the following warning is treated as an error [D:\Range-v3\build_x86\test\algorithm\alg.equal.vcxproj]
         D:\Range-v3\src\include\concepts/type_traits.hpp(89): note: see reference to class template instantiation 'concepts::detail::_builtin_common<T,U,void>' being compiled
                 with
                 [
                     T=bool (__cdecl &)(const int &,const int &),
                     U=bool (__cdecl &&)(const int &,const int &)
                 ]
         D:\Range-v3\src\include\concepts/type_traits.hpp(89): note: see reference to alias template instantiation 'meta::_t<concepts::detail::_builtin_common<T,U,void>>' being compiled
                 with
                 [
                     T=bool (__cdecl &)(const int &,const int &),
                     U=bool (__cdecl &&)(const int &,const int &)
                 ]
         D:\Range-v3\src\include\concepts/type_traits.hpp(346): note: see reference to alias template instantiation 'concepts::detail::_builtin_common_t<bool(__cdecl &)(const T &,const T &),U>' being compiled
                 with
                 [
                     T=int,
                     U=bool (__cdecl &&)(const int &,const int &)
                 ]
         D:\Range-v3\src\include\concepts/concepts.hpp(917): note: see reference to class template instantiation 'concepts::common_reference<T,U>' being compiled
                 with
                 [
                     T=bool (__cdecl &)(const int &,const int &),
                     U=bool (__cdecl &&)(const int &,const int &)
                 ]
         D:\Range-v3\src\include\concepts/concepts.hpp(910): note: see reference to alias template instantiation 'concepts::common_reference_t<bool(__cdecl &)(const T &,const T &),U>' being compiled
                 with
                 [
                     T=int,
                     U=bool (__cdecl &&)(const int &,const int &)
                 ]
         D:\Range-v3\src\include\concepts/concepts.hpp(910): note: while compiling class template member function 'identity<enable_if<concepts::defs::same_as<common_reference<T,U>::type,common_reference<U,T>::type>&&concepts::defs::convertible_to<T,common_reference<T,U>::type>&&concepts::defs::convertible_to<U,common_reference<T,U>::type>,void>::type>::invoke<int> concepts::defs::common_reference_with_concept::Requires_(void)'
         D:\Range-v3\src\include\concepts/concepts.hpp(917): note: while compiling class template member function 'concepts::defs::common_reference_with_concept::Eval<T,U>::operator bool(void) noexcept const'

Build FAILED.

       "D:\Range-v3\build_x86\Range-v3.sln" (Rebuild target) (1) ->
       "D:\Range-v3\build_x86\test\algorithm\alg.equal.vcxproj.metaproj" (Rebuild target) (36) ->
       "D:\Range-v3\build_x86\test\algorithm\alg.equal.vcxproj" (Rebuild target) (462) ->
       (ClCompile target) -> 
         D:\Range-v3\src\include\concepts/type_traits.hpp(167): warning C4180: qualifier applied to function type has no meaning; ignored [D:\Range-v3\build_x86\test\algorithm\alg.equal.vcxproj]

       "D:\Range-v3\build_x86\Range-v3.sln" (Rebuild target) (1) ->
       "D:\Range-v3\build_x86\test\algorithm\alg.equal.vcxproj.metaproj" (Rebuild target) (36) ->
       "D:\Range-v3\build_x86\test\algorithm\alg.equal.vcxproj" (Rebuild target) (462) ->
       (ClCompile target) -> 
         D:\Range-v3\src\include\concepts/type_traits.hpp(167): error C2220: the following warning is treated as an error [D:\Range-v3\build_x86\test\algorithm\alg.equal.vcxproj]

    1 Warning(s)
    1 Error(s)

Time Elapsed 00:03:49.57
[command took 229 seconds] 
CaseyCarter commented 5 years ago

Actual result: D:\Range-v3\src\include\concepts/type_traits.hpp(167): error C2220: the following warning is treated as an error [D:\Range-v3\build_x86\test\algorithm\alg.equal.vcxproj]

If you're going to quote the log for a build that failed with C2220, you should include the warning that's being treated as an error. It's not useful to know the the build failed due to a promoted warning without also knowing what that warning is.

EDIT: Sorry, I just saw it squirreled away in the differently-formatted bit at the end. I've thrown triple backticks (```) around the log snippet to give it monospace formatting so it's more readable.