Naios / continuable

C++14 asynchronous allocation aware futures (supporting then, exception handling, coroutines and connections)
https://naios.github.io/continuable/
MIT License
823 stars 44 forks source link

VS 16.2: parameter pack must be expanded in this context #23

Closed Rogiel closed 5 years ago

Rogiel commented 5 years ago

@Naios

Visual Studio 16.2 has introduced a bug with parameter pack expansions and this is affecting continuable.

[100%] Building CXX object test/unit-test/CMakeFiles/test-continuable-base.dir/test-continuable.cpp.obj
test-continuable.cpp
D:\Source\Projects\continuable\include\continuable/continuable-result.hpp(137): error C3520: 'Args': parameter pack must be expanded in this context
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.22.27905\include\type_traits(290): note: see reference to function template instantiation '_Add_reference<_Ty,void>::_Rvalue std::declval(void) noexcept' being compiled
D:\Source\Projects\continuable\include\continuable/detail/operations/loop.hpp(166): note: see reference to class template instantiation 'cti::result<>' being compiled
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.22.27905\include\chrono(591): note: see reference to class template instantiation 'std::chrono::duration<double,std::ratio<1,1>>' being compiled
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.22.27905\include\chrono(169): note: see reference to class template instantiation 'std::chrono::duration<__int64,std::nano>' being compiled
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.22.27905\include\chrono(570): note: see reference to class template instantiation 'std::chrono::time_point<std::chrono::steady_clock,std::chrono::steady_clock::duration>' being compiled
D:\Source\Projects\continuable\include\continuable/continuable-result.hpp(136): error C2672: 'std::declval': no matching overloaded function found
D:\Source\Projects\continuable\include\continuable/continuable-result.hpp(137): error C2893: Failed to specialize function template '_Add_reference<_Ty,void>::_Rvalue std::declval(void) noexcept'
D:\Source\Projects\continuable\include\continuable/continuable-result.hpp(137): note: With the following template arguments:
D:\Source\Projects\continuable\include\continuable/continuable-result.hpp(137): note: '_Ty=Args'
D:\Source\Projects\continuable\include\continuable/continuable-result.hpp(150): error C3520: 'Args': parameter pack must be expanded in this context
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.22.27905\include\type_traits(290): note: see reference to function template instantiation '_Add_reference<_Ty,void>::_Rvalue std::declval(void) noexcept' being compiled
D:\Source\Projects\continuable\include\continuable/continuable-result.hpp(149): error C2672: 'std::declval': no matching overloaded function found
D:\Source\Projects\continuable\include\continuable/continuable-result.hpp(150): error C2893: Failed to specialize function template '_Add_reference<_Ty,void>::_Rvalue std::declval(void) noexcept'
D:\Source\Projects\continuable\include\continuable/continuable-result.hpp(150): note: With the following template arguments:
D:\Source\Projects\continuable\include\continuable/continuable-result.hpp(150): note: '_Ty=Args'

Workaround

Removing the second template parameter on line 135 and the third parameter on line 148 seems to work around the issue.

This seems to be a MSVC bug when expanding std::declval<Args>()... expressions.


Your Environment

Naios commented 5 years ago

Thanks for your report. Could you provide a PR please, which applies the suggested fix?

Rogiel commented 5 years ago

Thanks for your report. Could you provide a PR please, which applies the suggested fix?

Yes, I can. But it's not really a fix, just a workaround/hack that disables the wrap signature check (done viavoid_t). I have tried to create a concise reproducible test case in which MSVC fails to compile (to report it to Microsoft) but no luck :(

Naios commented 5 years ago

This was fixed in 92d8bbad368a385fc94b775abe385dcf67af04c9