Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

packaged_task<void()> errors #32

Closed
alex85k opened this issue Aug 20, 2014 · 9 comments
Closed

packaged_task<void()> errors #32

alex85k opened this issue Aug 20, 2014 · 9 comments
Labels

Comments

@alex85k
Copy link

alex85k commented Aug 20, 2014

I have these errors and can not fix them myself:

C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\future(1014): error C2182: '_Get_value' : illegal use of type 'void' [D:\build_d\libosmium\build-cmake\examples\osmium_area_test.vcxproj]
          C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\future(1466) : see reference to class template instantiation 'std::_State_manager<_Ty>' being compiled
          with
          [
              _Ty=void
          ]
          C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\future(1747) : see reference to class template instantiation 'std::_Promise<_Ret>' being compiled
          with
          [
              _Ret=void
          ]
          C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\future(1747) : while compiling class template member function 'std::packaged_task<void (void)>::packaged_task(std::packaged_task<void (void)> &&) throw()'
          C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(1545) : see reference to function template instantiation 'std::packaged_task<void (void)>::packaged_task(std::packaged_task<void (void)> &&) throw()' being compiled
          D:\build_d\libosmium\include\osmium/thread/checked_task.hpp(55) : see reference to class template instantiation 'std::packaged_task<void (void)>' being compiled
          D:\build_d\libosmium\include\osmium/io/reader.hpp(176) : see reference to function template instantiation 'osmium::thread::CheckedTask<osmium::io::detail::ReadThread>::CheckedTask<osmium::thread::Queue<std::string>&,osmium::io::Decompressor*,std::atomic<bool>&>(osmium::thread::Queue<std::string> &,osmium::io::Decompressor *&&,std::atomic<bool> &)' being compiled
          D:\build_d\libosmium\include\osmium/io/reader.hpp(176) : see reference to function template instantiation 'osmium::thread::CheckedTask<osmium::io::detail::ReadThread>::CheckedTask<osmium::thread::Queue<std::string>&,osmium::io::Decompressor*,std::atomic<bool>&>(osmium::thread::Queue<std::string> &,osmium::io::Decompressor *&&,std::atomic<bool> &)' being compiled
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\future(1021): error C2182: '_Val' : illegal use of type 'void' [D:\build_d\libosmium\build-cmake\examples\osmium_area_test.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\future(1029): error C2182: '_Val' : illegal use of type 'void' [D:\build_d\libosmium\build-cmake\examples\osmium_area_test.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\future(1747): error C2665: 'std::forward' : none of the 2 overloads could convert all the argument types [D:\build_d\libosmium\build-cmake\examples\osmium_area_test.vcxproj]
          C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(1509): could be '_Ty &&std::forward<std::_Promise<_Ret>>(std::_Promise<_Ret> &&) throw()'
          with
          [
              _Ty=std::_Promise<void>
  ,            _Ret=void
          ]
          C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(1503): or       '_Ty &&std::forward<std::_Promise<_Ret>>(std::_Promise<_Ret> &)'
          with
          [
              _Ty=std::_Promise<void>
  ,            _Ret=void
          ]
          while trying to match the argument list '(std::_Promise<int>)'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\future(1749): error C2512: 'std::_Promise<int>' : no appropriate default constructor available [D:\build_d\libosmium\build-cmake\examples\osmium_area_test.vcxproj]
  osmium_convert.cpp

This is known to be an error or standard unclearness about packaged_task<void()>:
http://stackoverflow.com/questions/14744588/why-is-stdpackaged-taskvoid-not-valid

We had to add a workaround for this in OSRM:
Project-OSRM/osrm-backend@42d3ee9
Project-OSRM/osrm-backend#998 (comment)
in libosmium it seems much harder...

My half-fixed branch (with cmake-building of examples by build.bat):
https://github.com/alex85k/libosmium

@joto
Copy link
Member

joto commented Aug 20, 2014

@alex85k: Can you verify this works now?

@alex85k
Copy link
Author

alex85k commented Aug 20, 2014

Yes, this seems to be fixed. Thank you!

@alex85k
Copy link
Author

alex85k commented Aug 20, 2014

Sorry, it is not so clear - different task-related error showed:

C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xrefwrap(269): error C2280: 'std::_Callable_base<_Ty,false>::_Callable_base(const std::_Callable_base<_Ty,false> &)' : attempting to reference a deleted function [D:\build_d\libosmium2\build-cmake\examples\osmium_area_test.vcxproj]
          with
          [
              _Ty=osmium::io::detail::XMLParser
          ]
          C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xrefwrap(198) : compiler has generated 'std::_Callable_base<_Ty,false>::_Callable_base' here
          with
          [
              _Ty=osmium::io::detail::XMLParser
          ]
          C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\functional(180) : see reference to function template instantiation 'std::_Callable_obj<osmium::io::detail::XMLParser,false>::_Callable_obj<_Callable&>(_Ty2)' being compiled
          with
          [
              _Callable=_MyWrapper
  ,            _Ty2=_MyWrapper &
          ]
          C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\functional(180) : see reference to function template instantiation 'std::_Callable_obj<osmium::io::detail::XMLParser,false>::_Callable_obj<_Callable&>(_Ty2)' being compiled
          with
          [
              _Callable=_MyWrapper
  ,            _Ty2=_MyWrapper &
          ]
          C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\functional(177) : while compiling class template member function 'std::_Func_impl<_MyWrapper,_Alloc,_Ret,>::_Func_impl(std::_Func_impl<_MyWrapper,_Alloc,_Ret,> &)'
          with
          [
              _Alloc=std::allocator<std::_Func_class<bool,>>
  ,            _Ret=bool
          ]
          C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\functional(209) : see reference to function template instantiation 'std::_Func_impl<_MyWrapper,_Alloc,_Ret,>::_Func_impl(std::_Func_impl<_MyWrapper,_Alloc,_Ret,> &)' being compiled
          with
          [
              _Alloc=std::allocator<std::_Func_class<bool,>>
  ,            _Ret=bool
          ]
          C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\functional(495) : see reference to class template instantiation 'std::_Func_impl<_MyWrapper,_Alloc,_Ret,>' being compiled
          with
          [
              _Alloc=std::allocator<std::_Func_class<bool,>>
  ,            _Ret=bool
          ]
          C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\functional(396) : see reference to function template instantiation 'void std::_Func_class<_Ret,>::_Do_alloc<_Myimpl,_Ty,_Alloc>(_Fty &&,_Alloc)' being compiled
          with
          [
              _Ret=bool
  ,            _Ty=osmium::io::detail::XMLParser
  ,            _Alloc=std::allocator<std::_Func_class<bool,>>
  ,            _Fty=osmium::io::detail::XMLParser
          ]
          C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\functional(396) : see reference to function template instantiation 'void std::_Func_class<_Ret,>::_Do_alloc<_Myimpl,_Ty,_Alloc>(_Fty &&,_Alloc)' being compiled
          with
          [
              _Ret=bool
  ,            _Ty=osmium::io::detail::XMLParser
  ,            _Alloc=std::allocator<std::_Func_class<bool,>>
  ,            _Fty=osmium::io::detail::XMLParser
          ]
          C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\functional(385) : see reference to function template instantiation 'void std::_Func_class<_Ret,>::_Reset_alloc<_Ty,std::allocator<std::_Func_class<_Ret,>>>(_Fty &&,_Alloc)' being compiled
          with
          [
              _Ret=bool
  ,            _Ty=osmium::io::detail::XMLParser
  ,            _Fty=osmium::io::detail::XMLParser
  ,            _Alloc=std::allocator<std::_Func_class<bool,>>
          ]
          C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\functional(385) : see reference to function template instantiation 'void std::_Func_class<_Ret,>::_Reset_alloc<_Ty,std::allocator<std::_Func_class<_Ret,>>>(_Fty &&,_Alloc)' being compiled
          with
          [
              _Ret=bool
  ,            _Ty=osmium::io::detail::XMLParser
  ,            _Fty=osmium::io::detail::XMLParser
  ,            _Alloc=std::allocator<std::_Func_class<bool,>>
          ]
          C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\functional(671) : see reference to function template instantiation 'void std::_Func_class<_Ret,>::_Reset<_Ty>(_Fty &&)' being compiled
          with
          [
              _Ret=bool
  ,            _Ty=osmium::io::detail::XMLParser
  ,            _Fty=osmium::io::detail::XMLParser
          ]
          C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\functional(671) : see reference to function template instantiation 'void std::_Func_class<_Ret,>::_Reset<_Ty>(_Fty &&)' being compiled
          with
          [
              _Ret=bool
  ,            _Ty=osmium::io::detail::XMLParser
  ,            _Fty=osmium::io::detail::XMLParser
          ]
          C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\future(588) : see reference to function template instantiation 'std::function<_Ret (void)>::function<_Ty>(_Fx &&)' being compiled
          with
          [
              _Ret=bool
  ,            _Ty=osmium::io::detail::XMLParser
  ,            _Fx=osmium::io::detail::XMLParser
          ]
          C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\future(588) : see reference to function template instantiation 'std::function<_Ret (void)>::function<_Ty>(_Fx &&)' being compiled
          with
          [
              _Ret=bool
  ,            _Ty=osmium::io::detail::XMLParser
  ,            _Fx=osmium::io::detail::XMLParser
          ]
          C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\future(1742) : see reference to function template instantiation 'std::_Packaged_state<_Ret (void)>::_Packaged_state<_Ty>(_Fty2 &&)' being compiled
          with
          [
              _Ret=bool
  ,            _Ty=osmium::io::detail::XMLParser
  ,            _Fty2=osmium::io::detail::XMLParser
          ]
          C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\future(1744) : see reference to function template instantiation 'std::_Packaged_state<_Ret (void)>::_Packaged_state<_Ty>(_Fty2 &&)' being compiled
          with
          [
              _Ret=bool
  ,            _Ty=osmium::io::detail::XMLParser
  ,            _Fty2=osmium::io::detail::XMLParser
          ]
          D:\build_d\libosmium2\include\osmium/thread/checked_task.hpp(55) : see reference to function template instantiation 'std::packaged_task<bool (void)>::packaged_task<osmium::io::detail::XMLParser>(_Fty2 &&)' being compiled
          with
          [
              _Fty2=osmium::io::detail::XMLParser
          ]
          D:\build_d\libosmium2\include\osmium/thread/checked_task.hpp(55) : see reference to function template instantiation 'std::packaged_task<bool (void)>::packaged_task<osmium::io::detail::XMLParser>(_Fty2 &&)' being compiled
          with
          [
              _Fty2=osmium::io::detail::XMLParser
          ]
          D:\build_d\libosmium2\include\osmium/io/detail/xml_input_format.hpp(602) : see reference to function template instantiation 'osmium::thread::CheckedTask<osmium::io::detail::XMLParser>::CheckedTask<osmium::thread::Queue<std::string>&,osmium::thread::Queue<osmium::memory::Buffer>&,std::promise<osmium::io::Header>&,osmium::osm_entity_bits::type&,std::atomic<bool>&>(osmium::thread::Queue<std::string> &,osmium::thread::Queue<osmium::memory::Buffer> &,std::promise<osmium::io::Header> &,osmium::osm_entity_bits::type &,std::atomic<bool> &)' being compiled
          D:\build_d\libosmium2\include\osmium/io/detail/xml_input_format.hpp(602) : see reference to function template instantiation 'osmium::thread::CheckedTask<osmium::io::detail::XMLParser>::CheckedTask<osmium::thread::Queue<std::string>&,osmium::thread::Queue<osmium::memory::Buffer>&,std::promise<osmium::io::Header>&,osmium::osm_entity_bits::type&,std::atomic<bool>&>(osmium::thread::Queue<std::string> &,osmium::thread::Queue<osmium::memory::Buffer> &,std::promise<osmium::io::Header> &,osmium::osm_entity_bits::type &,std::atomic<bool> &)' being compiled

@joto
Copy link
Member

joto commented Aug 20, 2014

Difficult to see what the problem here is. Maybe it is missing a move constructor here?

Try adding XMLInputFormat(XMLInputFormat&& other) = default; to the XMLInputFormat class declaration.

@joto joto reopened this Aug 20, 2014
@alex85k
Copy link
Author

alex85k commented Aug 20, 2014

Tried this - no result, the same errors.
Adding XMLParser(XMLParser&& other) = default; to XMLParser did not help too...

@joto joto added the windows label Aug 21, 2014
@joto joto changed the title [windows] packaged_task<void()> errors packaged_task<void()> errors Aug 21, 2014
joto added a commit that referenced this issue Aug 21, 2014
@joto
Copy link
Member

joto commented Aug 21, 2014

@alex85k: Can you verify this is fixed by the last commit?

@alex85k
Copy link
Author

alex85k commented Aug 21, 2014

Yes, it was fixed, thank you!

@joto joto closed this as completed Aug 21, 2014
@alex85k
Copy link
Author

alex85k commented Aug 21, 2014

The same error showed up for OPLOutputBlock :)
Trying to add analogous copy-constructor.

@alex85k
Copy link
Author

alex85k commented Aug 21, 2014

Added something to compile: alex85k@6e430a1
( please rework )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants