This is a great library, but it can't be compiled normally in visual studio
Closed this issue · 6 comments
Error reported after include quickpool.hpp
`Build started
1> ------ build started: Project: basic, configuration: debug Win32------
1>basic_ form. cpp
1> F: \ CPP \ VisualStudio \ ide \ VC \ tools \ MSVC \ 14.29.30133 \ include \ vector (714,27): error c2440: "static_cast": unable to convert from "quickpool:: MEM:: aligned:: allocator < quickpool:: sched:: taskqueue, 64 >" to "quickpool:: mem:: aligned:: allocator < u, 64 >"
1> with
1> [
1> U=std::_ Container_ proxy
1> ]
1> F: \ CPP \ VisualStudio \ ide \ VC \ tools \ MSVC \ 14.29.30133 \ include \ vector (714,27): Message: no constructor can accept the source type, or the constructor overload decision is unclear
1> F: \ CPP \ VisualStudio \ ide \ VC \ tools \ MSVC \ 14.29.30133 \ include \ vector (711): Message: when compiling class template member functions "STD:: vector < quickpool:: sched:: taskqueue, quickpool:: MEM:: aligned:: allocator < quickpool:: sched:: taskqueue, 64 > >: ~ vector (void) noexcept"
1>F:\CppPro\test\02-basic\quickpool. HPP (553): Message: view the reference to the function template being compiled instantiating "STD:: vector < quickpool:: sched:: taskqueue, quickpool:: MEM:: aligned:: allocator < quickpool:: sched:: taskqueue, 64 > >: ~ vector (void) noexcept"
1>F:\CppPro\test\02-basic\quickpool. HPP (729): Message: view the reference to the class template being compiled instantiating "STD:: vector < quickpool:: sched:: taskqueue, quickpool:: MEM:: aligned:: allocator < quickpool:: sched:: taskqueue, 64 > >"
1> F: \ CPP \ VisualStudio \ ide \ VC \ tools \ MSVC \ 14.29.30133 \ include \ vector (714,25): error c2530: "_alproxy": reference must be initialized
1> F: \ CPP \ VisualStudio \ ide \ VC \ tools \ MSVC \ 14.29.30133 \ include \ vector (715,1): error c3536: "_alproxy": cannot be used before initialization
1> F: \ CPP \ VisualStudio \ ide \ VC \ tools \ MSVC \ 14.29.30133 \ include \ vector (715,9): error c2672: "_delete_plain_internal": no matching overloaded function found
1> F: \ CPP \ VisualStudio \ ide \ VC \ tools \ MSVC \ 14.29.30133 \ include \ vector (715,1): error c2893: failed to specialize the function template "void STD:: _delete_plain_internal (_alloc &, _alloc:: value_type * const) noexcept"
1> F: \ CPP \ VisualStudio \ ide \ VC \ tools \ MSVC \ 14.29.30133 \ include \ xmemory (998): Message: see the statement of "STD:: _delete_plain_internal"
1> F: \ CPP \ VisualStudio \ ide \ VC \ tools \ MSVC \ 14.29.30133 \ include \ vector (715,1): Message: use the following template parameters:
1>F:\CPP\VisualStudio\IDE\VC\Tools\MSVC\14.29.30133\include\vector(715,1): message : “_Alloc=int”
1> Finished building project 'basic. Vcxproj' - failed.
==========Generation: 0 successes, 1 failures, 0 latest, 0 skipped==========`
Hi. The library does compile on MSVC, but your version seems too old to fully support the C+11 standard, see https://en.cppreference.com/w/Template:cpp/compiler_support/11. It should work after updating your compiler.
I'll consider this resolved, let me know if there are still problems.
Error: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.32.31326\include\vector(793): error C2440: 'static_cast': cannot convert from 'quickpool::mem::aligned::allocator<quickpool::sched::TaskQueue,64>' to 'quickpool::mem::aligned::allocator<U,64>'
with
[
U=std::_Container_proxy
]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.32.31326\include\vector(793): note: No constructor could take the source type, or constructor overload resolution was ambiguous
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.32.31326\include\vector(790): note: while compiling class template member function 'std::vector<quickpool::sched::TaskQueue,quickpool::mem::aligned::allocator<quickpool::sched::TaskQueue,64>>::~vector(void) noexcept'
D:\a\libmumble\libmumble\3rdparty\quickpool\quickpool.hpp(553): note: see reference to function template instantiation 'std::vector<quickpool::sched::TaskQueue,quickpool::mem::aligned::allocator<quickpool::sched::TaskQueue,64>>::~vector(void) noexcept' being compiled
D:\a\libmumble\libmumble\3rdparty\quickpool\quickpool.hpp(729): note: see reference to class template instantiation 'std::vector<quickpool::sched::TaskQueue,quickpool::mem::aligned::allocator<quickpool::sched::TaskQueue,64>>' being compiled
Error: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.32.31326\include\vector(793): error C2530: '_Alproxy': references must be initialized
Error: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.32.31326\include\vector(794): error C3536: '_Alproxy': cannot be used before it is initialized
Error: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.32.31326\include\vector(794): error C2672: '_Delete_plain_internal': no matching overloaded function found
Error: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.32.31326\include\vector(794): error C2893: Failed to specialize function template 'void std::_Delete_plain_internal(_Alloc &,_Alloc::value_type *const ) noexcept'
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.32.31326\include\xmemory(984): note: see declaration of 'std::_Delete_plain_internal'
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.32.31326\include\vector(794): note: With the following template arguments:
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.32.31326\include\vector(794): note: '_Alloc=int'
This is caused by _ITERATOR_DEBUG_LEVEL
, from <vector>
:
_CONSTEXPR20 ~vector() noexcept {
_Tidy();
#if _ITERATOR_DEBUG_LEVEL != 0
auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal());
_Delete_plain_internal(_Alproxy, _STD exchange(_Mypair._Myval2._Myproxy, nullptr));
#endif // _ITERATOR_DEBUG_LEVEL != 0
}
With CMake's Debug
preset, _ITERATOR_DEBUG_LEVEL
is set to 2.
Could you try with #22? (I don't have access to a local MSVC machine unfortunately.)
It indeed fixes the issue, thanks!
Thx for checking!