Closed tjcbs closed 4 years ago
On VS2015:
#include <string> #include "robin_hood.h" int main() { robin_hood::unordered_flat_map<int, std::string> map; map[1] = "bug?"; }
Produces:
1>c:\projects\test\robin_hood.h(607): error C2476: 'constexpr' constructor does not initialize all members 1> c:\projects\test\robin_hood.h(642): note: 'robin_hood::pair<int,T>::first' was not initialized by the constructor 1> with 1> [ 1> T=std::string 1> ] 1> c:\projects\test\robin_hood.h(643): note: 'robin_hood::pair<int,T>::second' was not initialized by the constructor 1> with 1> [ 1> T=std::string 1> ] 1> c:\projects\test\robin_hood.h(918): note: see reference to function template instantiation 'robin_hood::pair<int,T>::pair<_Ty&&,>(std::piecewise_construct_t,std::tuple<_Ty &&>,std::tuple<>) noexcept' being compiled 1> with 1> [ 1> T=std::string, 1> _Ty=int 1> ] 1> c:\projects\test\robin_hood.h(918): note: see reference to function template instantiation 'robin_hood::pair<int,T>::pair<_Ty&&,>(std::piecewise_construct_t,std::tuple<_Ty &&>,std::tuple<>) noexcept' being compiled 1> with 1> [ 1> T=std::string, 1> _Ty=int 1> ] 1> c:\projects\test\robin_hood.h(2026): note: see reference to function template instantiation 'robin_hood::detail::Table<true,80,Key,T,Hash,KeyEqual>::DataNode<robin_hood::detail::Table<true,80,Key,T,Hash,KeyEqual>,true>::DataNode<const std::piecewise_construct_t&,std::tuple<_Ty &&>,std::tuple<>>(M &,const std::piecewise_construct_t &,std::tuple<_Ty &&> &&,std::tuple<> &&) noexcept' being compiled 1> with 1> [ 1> Key=int, 1> T=std::string, 1> Hash=robin_hood::hash<int>, 1> KeyEqual=std::equal_to<int>, 1> _Ty=int, 1> M=robin_hood::detail::Table<true,80,int,std::string,robin_hood::hash<int>,std::equal_to<int>> 1> ] 1> c:\projects\test\robin_hood.h(2025): note: see reference to function template instantiation 'robin_hood::detail::Table<true,80,Key,T,Hash,KeyEqual>::DataNode<robin_hood::detail::Table<true,80,Key,T,Hash,KeyEqual>,true>::DataNode<const std::piecewise_construct_t&,std::tuple<_Ty &&>,std::tuple<>>(M &,const std::piecewise_construct_t &,std::tuple<_Ty &&> &&,std::tuple<> &&) noexcept' being compiled 1> with 1> [ 1> Key=int, 1> T=std::string, 1> Hash=robin_hood::hash<int>, 1> KeyEqual=std::equal_to<int>, 1> _Ty=int, 1> M=robin_hood::detail::Table<true,80,int,std::string,robin_hood::hash<int>,std::equal_to<int>> 1> ] 1> c:\projects\test\robin_hood.h(1643): note: see reference to function template instantiation 'std::basic_string<char,std::char_traits<char>,std::allocator<char>> &robin_hood::detail::Table<true,80,Key,T,Hash,KeyEqual>::doCreateByKey<int,std::basic_string<char,std::char_traits<char>,std::allocator<char>>>(Arg &&)' being compiled 1> with 1> [ 1> Key=int, 1> T=std::string, 1> Hash=robin_hood::hash<int>, 1> KeyEqual=std::equal_to<int>, 1> Arg=int 1> ] 1> c:\projects\test\robin_hood.h(1643): note: see reference to function template instantiation 'std::basic_string<char,std::char_traits<char>,std::allocator<char>> &robin_hood::detail::Table<true,80,Key,T,Hash,KeyEqual>::doCreateByKey<int,std::basic_string<char,std::char_traits<char>,std::allocator<char>>>(Arg &&)' being compiled 1> with 1> [ 1> Key=int, 1> T=std::string, 1> Hash=robin_hood::hash<int>, 1> KeyEqual=std::equal_to<int>, 1> Arg=int 1> ] 1> c:\projects\test\test.cpp(10): note: see reference to function template instantiation 'std::basic_string<char,std::char_traits<char>,std::allocator<char>> &robin_hood::detail::Table<true,80,Key,T,Hash,KeyEqual>::operator []<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>(int &&)' being compiled 1> with 1> [ 1> Key=int, 1> T=std::string, 1> Hash=robin_hood::hash<int>, 1> KeyEqual=std::equal_to<int> 1> ] 1> c:\projects\test\test.cpp(10): note: see reference to function template instantiation 'std::basic_string<char,std::char_traits<char>,std::allocator<char>> &robin_hood::detail::Table<true,80,Key,T,Hash,KeyEqual>::operator []<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>(int &&)' being compiled 1> with 1> [ 1> Key=int, 1> T=std::string, 1> Hash=robin_hood::hash<int>, 1> KeyEqual=std::equal_to<int> 1> ]
Looks like a VS2015 bug to me. Can't you use something more recent?
On VS2015:
Produces: