I am trying to compile the following code in Visual Studio 2017:
#include
int main()
{
std::promise&
I suppose you do not need std::reference_wrapper<int>
. There is the suitable overloaded template for std::promise
available:
template<class R> class promise<R&>;
Therefore you can fix your code in Visual Studio 2017:
#include <future>
int main()
{
std::promise<int&> promise;
(void)promise;
}
Looks like it is a known issue in MSVC's standard library implementation. A simpler reproduction scenario:
#include <future>
struct NoDefaultCtor
{
NoDefaultCtor() = delete;
};
int main() {
std::promise<NoDefaultCtor> p;
return 0;
}