ned14 / outcome

Provides very lightweight outcome<T> and result<T> (non-Boost edition)
https://ned14.github.io/outcome
Other
704 stars 62 forks source link

Outcome build failed due to "error C3864 requires clause is incompatible with the declaration" under /std:c++latest(C++20) #202

Closed QuellaZhang closed 5 years ago

QuellaZhang commented 5 years ago

Outcome build failed due to "error C3864 requires clause is incompatible with the declaration" under /std:c++latest(C++20) on MSVC, 'requires' is a keyword in C++20. Could you help look at this? Thanks in advance!

Repro steps:

  1. git clone --recursive https://github.com/ned14/outcome D:\Outcome\src
  2. Open a VS 2017 x86 command prompt as admin and browse to D:\Outcome
  3. set CL=/std:c++latest
  4. mkdir build_x86 && pushd build_x86
  5. cmake -G "Visual Studio 15 2017" -DCMAKE_SYSTEM_VERSION=10.0.17134.0 ..\src\
  6. msbuild /m /p:Configuration=Release;Platform=Win32 All_BUILD.vcxproj /t:Rebuild

Our workaround:outcomelatest.patch.txt

Failures: D:\Outcome\src\include\outcome\detail/basic_result_storage.hpp(63): error C3864: 'outcome_v2_0c35dcf2::detail::basic_result_storage': requires clause is incompatible with the declaration D:\Outcome\src\include\outcome\detail/basic_result_storage.hpp(157): note: see reference to class template instantiation 'outcome_v2_0c35dcf2::detail::basic_result_storage<R,EC,NoValuePolicy>' being compiled D:\Outcome\src\include\outcome\detail/basic_result_storage.hpp(166): error C2955: 'outcome_v2_0c35dcf2::detail::basic_result_storage': use of class template requires template argument list D:\Outcome\src\include\outcome\detail/basic_result_storage.hpp(57): note: see declaration of 'outcome_v2_0c35dcf2::detail::basic_result_storage' D:\Outcome\src\include\outcome\detail/basic_result_storage.hpp(172): note: see reference to class template instantiation 'outcome_v2_0c35dcf2::detail::basic_result_storage_swap<value_throws,error_throws>' being compiled D:\Outcome\src\include\outcome\detail/basic_result_storage.hpp(166): error C2955: 'outcome_v2_0c35dcf2::detail::basic_result_storage': use of class template requires template argument list D:\Outcome\src\include\outcome\detail/basic_result_storage.hpp(57): note: see declaration of 'outcome_v2_0c35dcf2::detail::basic_result_storage' D:\Outcome\src\include\outcome\detail/basic_result_storage.hpp(166): error C2955: 'outcome_v2_0c35dcf2::detail::basic_result_storage': use of class template requires template argument list D:\Outcome\src\include\outcome\detail/basic_result_storage.hpp(57): note: see declaration of 'outcome_v2_0c35dcf2::detail::basic_result_storage' D:\Outcome\src\include\outcome\convert.hpp(38): error C2062: type 'bool' unexpected D:\Outcome\src\include\outcome\convert.hpp(39): error C2143: syntax error: missing ';' before '{' D:\Outcome\src\include\outcome\convert.hpp(39): error C2447: '{': missing function header (old-style formal list?) D:\Outcome\src\include\outcome\convert.hpp(50): error C2062: type 'bool' unexpected D:\Outcome\src\include\outcome\convert.hpp(51): error C2143: syntax error: missing ';' before '{' D:\Outcome\src\include\outcome\convert.hpp(51): error C2447: '{': missing function header (old-style formal list?) D:\Outcome\src\include\outcome\detail/basic_result_final.hpp(35): error C3203: 'basic_result_storage': unspecialized class template can't be used as a template argument for template parameter 'Base', expected a real type D:\Outcome\src\include\outcome\detail/basic_result_final.hpp(44): error C3770: 'unknown-type': is not a valid base class D:\Outcome\src\include\outcome\detail/basic_result_final.hpp(144): note: see reference to class template instantiation 'outcome_v2_0c35dcf2::detail::basic_result_final<R,S,NoValuePolicy>' being compiled D:\Outcome\src\include\outcome\basic_outcome.hpp(195): error C3864: 'outcome_v2_0c35dcf2::basic_outcome': requires clause is incompatible with the declaration D:\Outcome\src\include\outcome\basic_outcome.hpp(916): note: see reference to class template instantiation 'outcome_v2_0c35dcf2::basic_outcome<R,S,T,N>' being compiled D:\Outcome\src\include\outcome\basic_outcome.hpp(925): error C2955: 'outcome_v2_0c35dcf2::basic_outcome': use of class template requires template argument list D:\Outcome\src\include\outcome\basic_outcome.hpp(188): note: see declaration of 'outcome_v2_0c35dcf2::basic_outcome'

ned14 commented 5 years ago

You have a much more conforming C++ 20 implementation than the existing compilers Outcome was tested upon! Thanks for the BR, I'll try to schedule some remedial work on this later this week.

ned14 commented 5 years ago

Can you check if trunk is fixed on this please? I believe it ought to be.

QuellaZhang commented 5 years ago

Hi @ned14, sorry for the late. We removed the patch and built the latest Outcome source code dd50d7d, it still failed due to the above errors. I attached the build log. Could you help look?log_x86_build_outcome.log

ned14 commented 5 years ago

I fixed the obvious errors, but I suspect the next time you cycle this it will still fail. I am unsure what to do here, I cannot see how my code is not correct. I assume that your MSVC version will be the next point release of Visual Studio?

QuellaZhang commented 5 years ago

Thank you very much @ned14 . Double confirmed this issue has been fixed. Sorry for your confusion.

ned14 commented 5 years ago

Oh ok, Thanks for reporting the issue!