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

Add support for C++20 #2

Closed
SilverTuxedo opened this issue Sep 10, 2021 · 2 comments · Fixed by #3
Closed

Add support for C++20 #2

SilverTuxedo opened this issue Sep 10, 2021 · 2 comments · Fixed by #3

Comments

@SilverTuxedo
Copy link
Contributor

Hi,

The project doesn't compile if the language standard is set to ISO C++20 Standard (/std:c++20):

2>------ Build started: Project: stltest, Configuration: Debug x64 ------
2>Building 'stltest' with toolset 'WindowsKernelModeDriver10.0' and the 'Desktop' target platform.
2>deque_tests.cpp
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xmemory(469,66): error C2027: use of undefined type 'std::_Replace_first_parameter<_Other,_Ty>'
2>        with
2>        [
2>            _Other=int,
2>            _Ty=jxy::details::allocator<int,PagedPool,809976148>
2>        ]
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xmemory(469): message : see declaration of 'std::_Replace_first_parameter<_Other,_Ty>'
2>        with
2>        [
2>            _Other=int,
2>            _Ty=jxy::details::allocator<int,PagedPool,809976148>
2>        ]
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\deque(582): message : see reference to class template instantiation 'std::_Get_rebind_type<_Alloc,_Ty,void>' being compiled
2>        with
2>        [
2>            _Alloc=jxy::details::allocator<int,PagedPool,809976148>,
2>            _Ty=int
2>        ]
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xmemory(756): message : see reference to alias template instantiation 'std::_Normal_allocator_traits<_Alloc>::rebind_alloc<_Ty>' being compiled
2>        with
2>        [
2>            _Alloc=jxy::details::allocator<int,PagedPool,809976148>,
2>            _Ty=int
2>        ]
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\deque(582): message : see reference to alias template instantiation 'std::_Rebind_alloc_t<jxy::details::allocator<T,PagedPool,809976148>,_Ty>' being compiled
2>        with
2>        [
2>            T=int,
2>            _Ty=int
2>        ]
2>E:\Files\Code\C++\keval\kevald\stlkrn\stltest\deque_tests.cpp(16): message : see reference to class template instantiation 'std::deque<int,jxy::details::allocator<T,PagedPool,809976148>>' being compiled
2>        with
2>        [
2>            T=int
2>        ]
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xmemory(469,60): error C2061: syntax error: identifier 'type'
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xmemory(573,69): error C2794: 'type': is not a member of any direct or indirect base class of 'std::_Get_rebind_type<_Alloc,_Ty,void>'
2>        with
2>        [
2>            _Alloc=jxy::details::allocator<int,PagedPool,809976148>,
2>            _Ty=int
2>        ]
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\deque(582,53): error C2938: 'std::_Normal_allocator_traits<_Alloc>::rebind_alloc' : Failed to specialize alias template
2>        with
2>        [
2>            _Alloc=jxy::details::allocator<int,PagedPool,809976148>
2>        ]
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\deque(582,53): error C2938: 'std::_Rebind_alloc_t' : Failed to specialize alias template
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\deque(584,76): error C2955: 'std::allocator_traits': use of class template requires template argument list
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xmemory(737): message : see declaration of 'std::allocator_traits'
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\deque(591,55): error C2955: 'std::allocator_traits': use of class template requires template argument list
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xmemory(737): message : see declaration of 'std::allocator_traits'
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\deque(591,89): error C2955: 'std::allocator_traits': use of class template requires template argument list
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xmemory(737): message : see declaration of 'std::allocator_traits'
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\deque(592,36): error C2955: 'std::allocator_traits': use of class template requires template argument list
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xmemory(737): message : see declaration of 'std::allocator_traits'
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\deque(592,68): error C2955: 'std::allocator_traits': use of class template requires template argument list
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xmemory(737): message : see declaration of 'std::allocator_traits'
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\deque(592,101): error C2993: 'unknown-type': is not a valid type for non-type template parameter '_Test'
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\deque(595,58): error C2955: 'std::_Deque_val': use of class template requires template argument list
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\deque(540): message : see declaration of 'std::_Deque_val'
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\deque(600,52): error C2955: 'std::allocator_traits': use of class template requires template argument list
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xmemory(737): message : see declaration of 'std::allocator_traits'
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\deque(600,52): error C2039: 'size_type': is not a member of 'std::allocator_traits<_Alloc>'
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\deque(600,1): error C2061: syntax error: identifier 'size_type'
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\deque(601,52): error C2955: 'std::allocator_traits': use of class template requires template argument list
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xmemory(737): message : see declaration of 'std::allocator_traits'
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\deque(601,52): error C2039: 'difference_type': is not a member of 'std::allocator_traits<_Alloc>'
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\deque(601,1): error C2061: syntax error: identifier 'difference_type'
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\deque(602,52): error C2955: 'std::allocator_traits': use of class template requires template argument list
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xmemory(737): message : see declaration of 'std::allocator_traits'
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\deque(602,52): error C2039: 'pointer': is not a member of 'std::allocator_traits<_Alloc>'
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\deque(602,1): error C2061: syntax error: identifier 'pointer'
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\deque(603,52): error C2955: 'std::allocator_traits': use of class template requires template argument list
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xmemory(737): message : see declaration of 'std::allocator_traits'
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\deque(603,52): error C2039: 'const_pointer': is not a member of 'std::allocator_traits<_Alloc>'
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\deque(603,1): error C2061: syntax error: identifier 'const_pointer'
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\deque(607,55): error C3203: '_Deque_val': unspecialized class template can't be used as a template argument for template parameter '_Mydeque', expected a real type
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\deque(608,61): error C3203: '_Deque_val': unspecialized class template can't be used as a template argument for template parameter '_Mydeque', expected a real type
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\deque(609,65): error C3203: '_Deque_val': unspecialized class template can't be used as a template argument for template parameter '_Mydeque', expected a real type
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\deque(610,71): error C3203: '_Deque_val': unspecialized class template can't be used as a template argument for template parameter '_Mydeque', expected a real type
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\deque(614,22): error C2131: expression did not evaluate to a constant
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\deque(595,58): message : failure was caused by non-constant arguments or reference to a non-constant symbol
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\deque(595,58): message : see usage of 'std::_Deque_val<_Val_types>::_Block_size'
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\deque(624,39): error C2061: syntax error: identifier 'size_type'

[...]

Help would be greatly appreciated 😺

@SilverTuxedo
Copy link
Contributor Author

Figured it out - the allocator needs to have rebind defined for it. I'll open a pull request soon.

@jxy-s
Copy link
Owner

jxy-s commented Sep 11, 2021

Thanks, I'll take a look over the weekend. As long as this doesn't break cpp17 should be fine.

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

Successfully merging a pull request may close this issue.

2 participants