Quantcast
Channel: Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1616

Intel C++ Compiler 16.0.2 fails to compile C++11 code (using GCC 5.3.0 headers)

$
0
0

Hello,

I can't compile the following code:

#include <unordered_map>
#include <utility>
#include <tuple>

int main(int argc, char** argv) {
  std::unordered_map<int, int> map;
  int a1 = 0;
  int a2 = 1;
  map.emplace(std::piecewise_construct, std::make_tuple(a1), std::make_tuple(a2));
  return 0;
}

using the Intel C++ Compiler version 16.0.2 (from Parallel Studio XE 2016.2.181), when using the libstdc++ headers which ship with GCC 5.3.0. I'm compiling like this:

icpc -std=c++11 -o bla bla.cc

where bla.cc contains the above code. The error message is:

icpc -std=c++11 -o bla bla.cc
/usr/include/c++/5.3.0/bits/hashtable.h(1526): error: no instance of overloaded function "std::forward" matches the argument list
            argument types are: (const std::piecewise_construct_t)
  	__node_type* __node = this->_M_allocate_node(std::forward<_Args>(__args)...);
  	                                             ^
          detected during:
            instantiation of "std::pair<std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::iterator, bool> std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::_M_emplace(std::true_type, _Args &&) [with _Key=int, _Value=std::pair<const int, int>, _Alloc=std::allocator<std::pair<const int, int>>, _ExtractKey=std::__detail::_Select1st, _Equal=std::equal_to<int>, _H1=std::hash<int>,
                      _H2=std::__detail::_Mod_range_hashing, _Hash=std::__detail::_Default_ranged_hash, _RehashPolicy=std::__detail::_Prime_rehash_policy, _Traits=std::__umap_traits<false>, _Args=<const std::piecewise_construct_t &, std::tuple<int>, std::tuple<int>>]" at line 726
            instantiation of "std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::__ireturn_type std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::emplace(_Args &&...) [with _Key=int, _Value=std::pair<const int, int>, _Alloc=std::allocator<std::pair<const int, int>>, _ExtractKey=std::__detail::_Select1st, _Equal=std::equal_to<int>, _H1=std::hash<int>, _H2=std::__detail::_Mod_range_hashing,
                      _Hash=std::__detail::_Default_ranged_hash, _RehashPolicy=std::__detail::_Prime_rehash_policy, _Traits=std::__umap_traits<false>, _Args=<const std::piecewise_construct_t &, std::tuple<int>, std::tuple<int>>]" at line 380 of "/usr/include/c++/5.3.0/bits/unordered_map.h"
            instantiation of "std::pair<std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::iterator, bool> std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::emplace(_Args &&...) [with _Key=int, _Tp=int, _Hash=std::hash<int>, _Pred=std::equal_to<int>, _Alloc=std::allocator<std::pair<const int, int>>, _Args=<const std::piecewise_construct_t &, std::tuple<int>, std::tuple<int>>]" at line 9 of "bla.cc"

/usr/include/c++/5.3.0/bits/hashtable.h(1526): error: no instance of overloaded function "std::forward" matches the argument list
            argument types are: (const std::piecewise_construct_t)
  	__node_type* __node = this->_M_allocate_node(std::forward<_Args>(__args)...);
  	                                             ^
          detected during:
            instantiation of "std::pair<std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::iterator, bool> std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::_M_emplace(std::true_type, _Args &&) [with _Key=int, _Value=std::pair<const int, int>, _Alloc=std::allocator<std::pair<const int, int>>, _ExtractKey=std::__detail::_Select1st, _Equal=std::equal_to<int>, _H1=std::hash<int>,
                      _H2=std::__detail::_Mod_range_hashing, _Hash=std::__detail::_Default_ranged_hash, _RehashPolicy=std::__detail::_Prime_rehash_policy, _Traits=std::__umap_traits<false>, _Args=<const std::piecewise_construct_t &, std::tuple<int>, std::tuple<int>>]" at line 726
            instantiation of "std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::__ireturn_type std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::emplace(_Args &&...) [with _Key=int, _Value=std::pair<const int, int>, _Alloc=std::allocator<std::pair<const int, int>>, _ExtractKey=std::__detail::_Select1st, _Equal=std::equal_to<int>, _H1=std::hash<int>, _H2=std::__detail::_Mod_range_hashing,
                      _Hash=std::__detail::_Default_ranged_hash, _RehashPolicy=std::__detail::_Prime_rehash_policy, _Traits=std::__umap_traits<false>, _Args=<const std::piecewise_construct_t &, std::tuple<int>, std::tuple<int>>]" at line 380 of "/usr/include/c++/5.3.0/bits/unordered_map.h"
            instantiation of "std::pair<std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::iterator, bool> std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::emplace(_Args &&...) [with _Key=int, _Tp=int, _Hash=std::hash<int>, _Pred=std::equal_to<int>, _Alloc=std::allocator<std::pair<const int, int>>, _Args=<const std::piecewise_construct_t &, std::tuple<int>, std::tuple<int>>]" at line 9 of "bla.cc"

compilation aborted for bla.cc (code 2)

The same code compiles fine using GCC 5.3.0 and Clang 3.7. Any ideas? Is this a compiler bug?


Viewing all articles
Browse latest Browse all 1616

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>