- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Just like in this thread, http://software.intel.com/en-us/forums/topic/394395, icpc is having difficulties compiling a simple C++11 compliant program with the GCC 4.8.1 headers.
icpc -std=c++11 emplace.cpp
include/c++/4.8.1/bits/hashtable.h(395): error: "_Hashtable" is not a nonstatic data member or base class of class
"std::_Hashtable<std::string, std::pair<const std::string, std::string>, std::allocator<std::pair<const std::string, std::string>>, std::__detail::_Select1st, std::equal_to<std::string>, std::hash<std::string>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__umap_traits<true>>"
: _Hashtable(__n, __hf, __detail::_Mod_range_hashing(),
^
detected during:
instantiation of "std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::_Hashtable(std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::size_type, const _H1 &, const std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::key_equal &, const std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy,
_Traits>::allocator_type &) [with _Key=std::string, _Value=std::pair<const std::string, std::string>, _Alloc=std::allocator<std::pair<const std::string, std::string>>, _ExtractKey=std::__detail::_Select1st, _Equal=std::equal_to<std::string>, _H1=std::hash<std::string>, _H2=std::__detail::_Mod_range_hashing, _Hash=std::__detail::_Default_ranged_hash, _RehashPolicy=std::__detail::_Prime_rehash_policy, _Traits=std::__umap_traits<true>]" at line 143 of
"include/c++/4.8.1/bits/unordered_map.h"
instantiation of "std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::size_type, const std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hasher &, const std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_equal &, const std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::allocator_type &) [with _Key=std::string, _Tp=std::string, _Hash=std::hash<std::string>, _Pred=std::equal_to<std::string>,
_Alloc=std::allocator<std::pair<const std::string, std::string>>]" at line 8 of "emplace.cpp"
include/c++/4.8.1/bits/hashtable.h(395): error: expected a ")"
: _Hashtable(__n, __hf, __detail::_Mod_range_hashing(),
^
detected during:
instantiation of "std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::_Hashtable(std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::size_type, const _H1 &, const std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::key_equal &, const std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy,
_Traits>::allocator_type &) [with _Key=std::string, _Value=std::pair<const std::string, std::string>, _Alloc=std::allocator<std::pair<const std::string, std::string>>, _ExtractKey=std::__detail::_Select1st, _Equal=std::equal_to<std::string>, _H1=std::hash<std::string>, _H2=std::__detail::_Mod_range_hashing, _Hash=std::__detail::_Default_ranged_hash, _RehashPolicy=std::__detail::_Prime_rehash_policy, _Traits=std::__umap_traits<true>]" at line 143 of
"include/c++/4.8.1/bits/unordered_map.h"
instantiation of "std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::size_type, const std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hasher &, const std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_equal &, const std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::allocator_type &) [with _Key=std::string, _Tp=std::string, _Hash=std::hash<std::string>, _Pred=std::equal_to<std::string>,
_Alloc=std::allocator<std::pair<const std::string, std::string>>]" at line 8 of "emplace.cpp"
include/c++/4.8.1/bits/hashtable.h(398): error: no default constructor exists for class "std::__detail::_Hashtable_base<std::string, std::pair<const std::string, std::string>, std::__detail::_Select1st, std::equal_to<std::string>, std::hash<std::string>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__umap_traits<true>>"
{ }
^
detected during:
instantiation of "std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::_Hashtable(std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::size_type, const _H1 &, const std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::key_equal &, const std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy,
_Traits>::allocator_type &) [with _Key=std::string, _Value=std::pair<const std::string, std::string>, _Alloc=std::allocator<std::pair<const std::string, std::string>>, _ExtractKey=std::__detail::_Select1st, _Equal=std::equal_to<std::string>, _H1=std::hash<std::string>, _H2=std::__detail::_Mod_range_hashing, _Hash=std::__detail::_Default_ranged_hash, _RehashPolicy=std::__detail::_Prime_rehash_policy, _Traits=std::__umap_traits<true>]" at line 143 of
"include/c++/4.8.1/bits/unordered_map.h"
instantiation of "std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::size_type, const std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hasher &, const std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_equal &, const std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::allocator_type &) [with _Key=std::string, _Tp=std::string, _Hash=std::hash<std::string>, _Pred=std::equal_to<std::string>,
_Alloc=std::allocator<std::pair<const std::string, std::string>>]" at line 8 of "emplace.cpp"
include/c++/4.8.1/bits/hashtable.h(398): error: no default constructor exists for class "std::__detail::_Before_begin<std::allocator<std::__detail::_Hash_node<std::pair<const std::string, std::string>, true>>>"
{ }
^
detected during:
instantiation of "std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::_Hashtable(std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::size_type, const _H1 &, const std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::key_equal &, const std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy,
_Traits>::allocator_type &) [with _Key=std::string, _Value=std::pair<const std::string, std::string>, _Alloc=std::allocator<std::pair<const std::string, std::string>>, _ExtractKey=std::__detail::_Select1st, _Equal=std::equal_to<std::string>, _H1=std::hash<std::string>, _H2=std::__detail::_Mod_range_hashing, _Hash=std::__detail::_Default_ranged_hash, _RehashPolicy=std::__detail::_Prime_rehash_policy, _Traits=std::__umap_traits<true>]" at line 143 of
"include/c++/4.8.1/bits/unordered_map.h"
instantiation of "std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::size_type, const std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hasher &, const std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_equal &, const std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::allocator_type &) [with _Key=std::string, _Tp=std::string, _Hash=std::hash<std::string>, _Pred=std::equal_to<std::string>,
_Alloc=std::allocator<std::pair<const std::string, std::string>>]" at line 8 of "emplace.cpp"
compilation aborted for emplace.cpp (code 2)
You can find the header file there: http://gcc.gnu.org/gcc-4.8/
Needless to say that the file compiles with G++ or Clang.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
While I cannot test your code, I do recall an old bug in ICC that may have resurfaced. It would be easy enough for you to investigate (or Intel to investigate). This was for some constructs of templated the compiler took issue with ">>" (adjacent close angle bracktes). The work around was to insert a space "> >". If insertting the space corrects the problem then this will give the ICC developers something to work on, and more importantly, it will get you up and running while you await a fix.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the suggestion. Unfortunately, this didn't fix the problem (same errors). I attached the (original) header just in case people can't get their hands on hashtable.h.
Also note that icpc -v returns "icpc version 13.1.3 (gcc version 4.7.0 compatibility)" while I'm using gcc version 4.8.1. I guess this discrepancy is somehow linked to the failed compilation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks to your remark and some modifications to hashtable.h and hashtable_policy.h, I now only have two errors left.
hashtable.h(397): error: "_Hashtable" is not a nonstatic data member or base class of class "std::_Hashtable<std::string, std::pair<const std::string, std::string>, std::allocator<std::pair<const std::string, std::string>>, std::__detail::_Select1st, std::equal_to<std::string>, std::hash<std::string>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__umap_traits<true>>"
: _Hashtable(__n, __hf, __detail::_Mod_range_hashing(),
^
detected during:
instantiation of "std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::_Hashtable(std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::size_type, const _H1 &, const std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::key_equal &, const std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy,
_Traits>::allocator_type &) [with _Key=std::string, _Value=std::pair<const std::string, std::string>, _Alloc=std::allocator<std::pair<const std::string, std::string>>, _ExtractKey=std::__detail::_Select1st, _Equal=std::equal_to<std::string>, _H1=std::hash<std::string>, _H2=std::__detail::_Mod_range_hashing, _Hash=std::__detail::_Default_ranged_hash, _RehashPolicy=std::__detail::_Prime_rehash_policy, _Traits=std::__umap_traits<true>]" at line 143 of
"include/c++/4.8.1/bits/unordered_map.h"
instantiation of "std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::size_type, const std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hasher &, const std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_equal &, const std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::allocator_type &) [with _Key=std::string, _Tp=std::string, _Hash=std::hash<std::string>, _Pred=std::equal_to<std::string>,
_Alloc=std::allocator<std::pair<const std::string, std::string>>]" at line 10 of "emplace.cpp"
hashtable.h(397): error: expected a ")"
: _Hashtable(__n, __hf, __detail::_Mod_range_hashing(),
^
detected during:
instantiation of "std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::_Hashtable(std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::size_type, const _H1 &, const std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::key_equal &, const std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy,
_Traits>::allocator_type &) [with _Key=std::string, _Value=std::pair<const std::string, std::string>, _Alloc=std::allocator<std::pair<const std::string, std::string>>, _ExtractKey=std::__detail::_Select1st, _Equal=std::equal_to<std::string>, _H1=std::hash<std::string>, _H2=std::__detail::_Mod_range_hashing, _Hash=std::__detail::_Default_ranged_hash, _RehashPolicy=std::__detail::_Prime_rehash_policy, _Traits=std::__umap_traits<true>]" at line 143 of
"include/c++/4.8.1/bits/unordered_map.h"
instantiation of "std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::size_type, const std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hasher &, const std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_equal &, const std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::allocator_type &) [with _Key=std::string, _Tp=std::string, _Hash=std::hash<std::string>, _Pred=std::equal_to<std::string>,
_Alloc=std::allocator<std::pair<const std::string, std::string>>]" at line 10 of "emplace.cpp"
If someone has any clue on how to fix that, I'd be very grateful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I found a temporary patch by just using the headers from gcc 4.7.1. It seems to work fine but I find that quite ugly. If someone has a better solution, please let me know. I'm still curious as to why it compiles fine with g++ and clang++, which are to my knowledge not the most "tolerant" compilers. For example, the following test case idea provided by Sergey obviously doesn't compile with either of them.
Sergey Kostrov wrote:
there is No a default constructor ( you could easily reproduce that issue with a test case that has just 2 classes ). This is how that failing piece of codes looks like:

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page