Intel C++ compiler, libc++, std::tuple issue

Intel C++ compiler, libc++, std::tuple issue

Hi all,

I'm using Intel C++ Compiler 14.0.3 and libc++ on Mac OS X 10.9.3. The following code compiles cleanly in clang and gcc but not on icpc. Maybe a compiler bug?

Many thanks,

-mc.

 

#include <tuple>
#include <algorithm>
#include <vector>


typedef std::tuple<double, double, double> DataTuple;

int main(void)
{
    struct comparator
    {
        bool operator() (const DataTuple& a, const DataTuple& b)
        {
            return (std::get<0>(a) < std::get<0>(b));
        }
    } mycomp;

    std::vector<DataTuple> vec;
    std::sort(vec.begin(), vec.end(), mycomp);
    
    return 0;
}

Error message:

/mylibcxx/include/tuple(174): error: identifier "_Hp" is undefined
      _NOEXCEPT_(__is_nothrow_swappable<_Hp>::value)
      ^
          detected during:
            instantiation of "void std::__1::swap(std::__1::__tuple_leaf<_Ip, _Hp, _Ep> &, std::__1::__tuple_leaf<_Ip, _Hp, _Ep> &) [with _Ip=0UL, _Hp=double, _Ep=false]" at line 3340 of "/mylibcxx/include/type_traits"
            instantiation of class "std::__1::__is_nothrow_swappable_imp<<unnamed>, _Tp> [with <unnamed>=true, _Tp=std::__1::__tuple_leaf<0UL, double, false>]" at line 3352 of "/mylibcxx/include/type_traits"
            instantiation of class "std::__1::__is_nothrow_swappable<_Tp> [with _Tp=std::__1::__tuple_leaf<0UL, double, false>]" at line 284
            instantiation of "int std::__1::__tuple_leaf<_Ip, _Hp, <unnamed>>::swap(std::__1::__tuple_leaf<_Ip, _Hp, <unnamed>> &) [with _Ip=0UL, _Hp=double, <unnamed>=false]" at line 285
            instantiation of "int std::__1::__tuple_leaf<_Ip, _Hp, <unnamed>>::swap(std::__1::__tuple_leaf<_Ip, _Hp, <unnamed>> &) [with _Ip=0UL, _Hp=double, <unnamed>=false]" at line 481
            instantiation of "void std::__1::__tuple_impl<std::__1::__tuple_indices<_Indx...>, _Tp...>::swap(std::__1::__tuple_impl<std::__1::__tuple_indices<_Indx...>, _Tp...> &) [with _Indx=<0UL, 1UL, 2UL>, _Tp=<double, double, double>]" at line 670
            instantiation of "void std::__1::tuple<_Tp...>::swap(std::__1::tuple<_Tp...> &) [with _Tp=<double, double, double>]" at line 704
            instantiation of "std::__1::enable_if<std::__1::__all<std::__1::__is_swappable<_Tp>::value...>::value, void>::type std::__1::swap(std::__1::tuple<_Tp...> &, std::__1::tuple<_Tp...> &) [with _Tp=<double, double, double>]" at line 3840 of "/mylibcxx/include/algorithm"
            instantiation of "void std::__1::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _Compare=comparator &, _RandomAccessIterator=DataTuple *]" at line 4025 of "/mylibcxx/include/algorithm"
            instantiation of "void std::__1::sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator=DataTuple *, _Compare=comparator &]" at line 4059 of "/mylibcxx/include/algorithm"
            instantiation of "void std::__1::sort(std::__1::__wrap_iter<_Tp *>, std::__1::__wrap_iter<_Tp *>, _Compare) [with _Tp=DataTuple, _Compare=comparator]" at line 19 of "icpc_bug.cpp"

 

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi Matteo,

I've got a problem report on this issue into our front-end team. I'll keep you posted on their status. Unfortunately, I don't know of a workaround at this point.

Brandon Hewitt Technical Consulting Engineer Tools Knowledge Base: "http://software.intel.com/en-us/articles/tools" Software Product Support info: "http://www.intel.com/software/support"

Looks like an error during header file parsing phase.

Yes, it is obvious that the error happens when the header file is processed :) But I suspect that icpc has some template-related stuff broken, since the same code has no problems when compiled with clang or gcc.

 

It looks like known issue. Internal tracker #254500.

I'll post a status changes here.

--Sergey

Login to leave a comment.