ned14 / outcome

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

The contents of <coroutine> are not available with /await on MSVC #240

Closed QuellaZhang closed 3 years ago

QuellaZhang commented 3 years ago

Hi All,

The Outome failed to build due to the following error on MSVC, the error message is sent from here https://github.com/microsoft/STL/blob/04eca1ccced7818c1625b1aa3c73a1ef4835f92d/stl/inc/coroutine#L13, could you help look? Thanks.

#ifdef _RESUMABLE_FUNCTIONS_SUPPORTED #pragma message("The contents of <coroutine> are not available with /await.") #pragma message("Remove /await for standard coroutines or use <experimental/coroutine> for legacy /await support.") #else // ^^^ /await ^^^ / vvv no /await vvv

Command line: CL.exe /c /IF:\gitP\ned14\outcome\include /IF:\gitP\ned14\outcome\build_x86\quickcpplib\include /nologo /W3 /WX- /diagnostics:column /O2 /Ob2 /Oy- /D WIN32 /D _WINDOWS /D NDEBUG /D SYSTEM_ERROR2_NOT_POSIX=1 /D "SYSTEM_ERROR2_FATAL=::abort()" /D "CMAKE_INTDIR=\"Release\"" /D _MBCS /Gm- /MD /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR- /Gd /TP /wd4530 /wd4577 /analyze- /errorReport:queue /await "F:\gitP\ned14\outcome\test\tests\coroutine-support.cpp"

Error message: coroutine-support.cpp The contents of are not available with /await. Remove /await for standard coroutines or use <experimental/coroutine> for legacy /await support. F:\gitP\ned14\outcome\include\outcome\detail/coroutine_support.ipp(55,65): error C2039: 'coroutine_handle': is not a member of 'std' C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.26.28801\include\atomic(133): note: see declaration of 'std' F:\gitP\ned14\outcome\include\outcome\detail/coroutine_support.ipp(55,35): error C2061: syntax error: identifier 'coroutine_handle' F:\gitP\ned14\outcome\include\outcome\detail/coroutine_support.ipp(56,18): error C2059: syntax error: '...' F:\gitP\ned14\outcome\include\outcome\detail/coroutine_support.ipp(56,58): error C2039: 'coroutine_traits': is not a member of 'std' C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.26.28801\include\atomic(133): note: see declaration of 'std' F:\gitP\ned14\outcome\include\outcome\detail/coroutine_support.ipp(57,14): error C2039: 'suspend_always': is not a member of 'std' C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.26.28801\include\atomic(133): note: see declaration of 'std'

ned14 commented 3 years ago

Thanks for reporting this unfortunate choice of semantics by the MSVC compiler team.

It's already fixed in https://github.com/ned14/outcome/commit/8c0f5274334268755f6ff604347e65c6bd4a12cd, but as the Boost C++ Libraries are just about to release, I cannot modify the primary branches. They should release by end of this week, then I'll swap over the branches and your build failure will resolve.

QuellaZhang commented 3 years ago

Thanks for letting me know this and let's wait for the new Boost C++ library.

QuellaZhang commented 3 years ago

@ned14 ,I tried your fix to unblock our runs. I built Outcome under /std:c++latest mode but this issue still occurs, the command still contians the "/await" option. According to the error message, we should remove /await for standard coroutines. Could you help look again? Thanks.

ned14 commented 3 years ago

I appreciate your patience. The fix is specifically in the commit https://github.com/ned14/outcome/commit/8c0f5274334268755f6ff604347e65c6bd4a12cd. The Boost release is now in final release candidate, it could go out today or tomorrow.

QuellaZhang commented 3 years ago

Ah, sorry for the confusion. The fix in the commit 8c0f527 works without /std:c++latest, but does not work with /std:c++latest. Anyway, I will continue to wait.

ned14 commented 3 years ago

If it's an internal compiler error when /std:c++latest is on, I reported that to Microsoft some weeks ago, and they have fixed it in a forthcoming new release of the compiler.

QuellaZhang commented 3 years ago

No, it's not the internal compiler error under /std:c++latest, it's the same error as mentioned in this issue when /std:c++latest is on. Can you understand me? Accroding to the feedback, VS 16.9 Preview 1.0 has been released, you can have a try on this version.

/std:c++latest is on + fix in the commit 8c0f527: F:\outcome\include\outcome\detail/coroutine_support.ipp(55,65): error C2039: 'coroutine_handle': is not a member of 'std' [F:\outcome\build_x86\outcome_hl--coroutine-support-permissive.vcxproj] F:\outcome\include\outcome\detail/coroutine_support.ipp(55,35): error C2061: syntax error: identifier 'coroutine_handle' [F:\outcome\build_x86\outcome_hl--coroutine-support-permissive.vcxproj] F:\outcome\include\outcome\detail/coroutine_support.ipp(56,18): error C2059: syntax error: '...' [F:\outcome\build_x86\outcome_hl--coroutine-support-permissive.vcxproj] F:\outcome\include\outcome\detail/coroutine_support.ipp(56,58): error C2039: 'coroutine_traits': is not a member of 'std' [F:\outcome\build_x86\outcome_hl--coroutine-support-permissive.vcxproj] F:\outcome\include\outcome\detail/coroutine_support.ipp(57,14): error C2039: 'suspend_always': is not a member of 'std' [F:\outcome\build_x86\outcome_hl--coroutine-support-permissive.vcxproj] F:\outcome\include\outcome\detail/coroutine_support.ipp(57,3): error C2873: 'suspend_always': symbol cannot be used in a using-declaration [F:\outcome\build_x86\outcome_hl--coroutine-support-permissive.vcxproj]

ned14 commented 3 years ago

Should be fixed now, thanks for the bug report.