Re: [eigen] Compile bug: aligned_allocator, gcc 4.8.2

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


I have to add:

I am using the -std=c++11  flag.




On 05/18/2015 05:54 PM, Gabriel wrote:
Hello all,

I recently switched to the newest dev version 3.2.90 and
the following compile bug (only under gcc 4.8.2, 4.9 compiles fine ) arised:
This code worked before or did I use something incorrectly up to now?


Thanks a lot for the insight!

=====================================
#include <Eigen/Dense>

class A{
public:
    A(){}
};

template<typename Key, typename Type, typename Hash = std::hash<Key>, typename Pred = std::equal_to<Key> >
using StdUMapAligned = std::unordered_map<Key, Type, Hash, Pred, Eigen::aligned_allocator<std::pair<const Key, Type> > >;


int  main(){
    StdUMapAligned<unsigned int , A > a;
    unsigned int i = 0;
    auto & r = a[i];                                             
    /* compile error  Eigen::aligned_allocator<T>::construct(Eigen::aligned_allocator<T>::pointer, const T&) NOT MATCHED */
}
=====================================

error:

/usr/include/c++/4.8/bits/hashtable.h||In instantiation of 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::__node_type* std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::_M_allocate_node(_Args&& ...) [with _Args = {const std::piecewise_construct_t&, std::tuple<const unsigned int&>, std::tuple<>}; _Key = unsigned int; _Value = std::pair<const unsigned int, A>; _Alloc = Eigen::aligned_allocator<std::pair<const unsigned int, A> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<unsigned int>; _H1 = std::hash<unsigned int>; _H2 = std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<false, false, true>; std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::__node_type = std::__detail::_Hash_node<std::pair<const unsigned int, A>, false>]':|

/usr/include/c++/4.8/bits/hashtable_policy.h|493|required from 'std::__detail::_Map_base<_Key, _Pair, _Alloc, std::__detail::_Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true>::mapped_type& std::__detail::_Map_base<_Key, _Pair, _Alloc, std::__detail::_Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true>::operator[](const key_type&) [with _Key = unsigned int; _Pair = std::pair<const unsigned int, A>; _Alloc = Eigen::aligned_allocator<std::pair<const unsigned int, A> >; _Equal = std::equal_to<unsigned int>; _H1 = std::hash<unsigned int>; _H2 = std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<false, false, true>; std::__detail::_Map_base<_Key, _Pair, _Alloc, std::__detail::_Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true>::mapped_type = A; std::__detail::_Map_base<_Key, _Pair, _Alloc, std::__detail::_Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true>::key_type = unsigned int]'|

/usr/include/c++/4.8/bits/unordered_map.h|596|required from 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type& std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type&) [with _Key = unsigned int; _Tp = A; _Hash = std::hash<unsigned int>; _Pred = std::equal_to<unsigned int>; _Alloc = Eigen::aligned_allocator<std::pair<const unsigned int, A> >; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type = A; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_type = unsigned int]'|

main.cpp|108|required from here|
/usr/include/c++/4.8/bits/hashtable.h|727|error: no matching function for call to 'Eigen::aligned_allocator<std::__detail::_Hash_node<std::pair<const unsigned int, A>, false> >::construct(std::_Hashtable<unsigned int, std::pair<const unsigned int, A>, Eigen::aligned_allocator<std::pair<const unsigned int, A> >, std::__detail::_Select1st, std::equal_to<unsigned int>, std::hash<unsigned int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::__node_type*&, const std::piecewise_construct_t&, std::tuple<const unsigned int&>, std::tuple<>)'|
/usr/include/c++/4.8/bits/hashtable.h|727|note: candidate is:|

/usr/local/include/eigen3/Eigen/src/Core/util/Memory.h|729|note: void Eigen::aligned_allocator<T>::construct(Eigen::aligned_allocator<T>::pointer, const T&) [with T = std::__detail::_Hash_node<std::pair<const unsigned int, A>, false>; Eigen::aligned_allocator<T>::pointer = std::__detail::_Hash_node<std::pair<const unsigned int, A>, false>*]|

/usr/local/include/eigen3/Eigen/src/Core/util/Memory.h|729|note:   candidate expects 2 arguments, 4 provided|

||=== Build failed: 1 error(s), 4 warning(s) (0 minute(s), 3 second(s)) ===|



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/