Can't use std::make_tuple + std::unique_ptr with Intel compiler

Can't use std::make_tuple + std::unique_ptr with Intel compiler

Hello.

My compiler version is: Intel Composer XE 2013 SP1 14.0.0 20130728

I can't compile succesfully this code:

#include <tuple>
#include <memory>
int main()
{
    auto a = std::make_tuple(std::unique_ptr<char>(new char), 0);
    return 0;
}

Command line is:

icpc tmp.cpp -gcc-name=gcc-4.7 -std=gnu++11 -lstdc++

Error message:

/usr/include/c++/4.7/type_traits(1251): error: function "std::unique_ptr<_Tp, _Dp>::unique_ptr(const std::unique_ptr<_Tp, _Dp> &) [with _Tp=char, _Dp=std::default_delete<char>]" (declared at line 262 of "/usr/include/c++/4.7/bits/unique_ptr.h") cannot be referenced -- it is a deleted function
          static decltype(__test_aux<_To1>(std::declval<_From1>()), __one())
                                           ^
          detected during:
            instantiation of "std::__is_convertible_helper<_From, _To, false>::__test [with _From=const std::unique_ptr<char, std::default_delete<char>> &, _To=std::unique_ptr<char, std::default_delete<char>>]" based on template arguments <const std::unique_ptr<char, std::default_delete<char>> &, std::unique_ptr<char, std::default_delete<char>>> at line 1258
            instantiation of class "std::__is_convertible_helper<_From, _To, false> [with _From=const std::unique_ptr<char, std::default_delete<char>> &, _To=std::unique_ptr<char, std::default_delete<char>>]" at line 1265
            instantiation of class "std::is_convertible<_From, _To> [with _From=const std::unique_ptr<char, std::default_delete<char>> &, _To=std::unique_ptr<char, std::default_delete<char>>]" at line 117
            instantiation of class "std::__and_<_B1, _B2> [with _B1=std::is_convertible<const std::unique_ptr<char, std::default_delete<char>> &, std::unique_ptr<char, std::default_delete<char>>>, _B2=std::is_convertible<const int &, int>]" at line 848 of "/usr/include/c++/4.7/tuple"
            instantiation of "std::tuple<std::__decay_and_strip<_Elements>::__type...> std::make_tuple(_Elements &&...) [with _Elements=<std::unique_ptr<char, std::default_delete<char>>, int>]" at line 9 of "tmp.cpp"

compilation aborted for tmp.cpp (code 2)

What's wrong? If I'm compile it by the GCC compiler, there are no errors.

Thanks.

5 帖子 / 0 全新
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项

I'm sorry I forgot to tell about the OS and GCC version.

I'm using Linux Debian 7 (3.2.0-4-amd64) and GCC 4.7.2

I'm sorry, Is it really unsolvable problem and nobody can to help me?

 

Thanks for reporting this. I can reproduce this with 14.0 but it looks to be fixed in our development compiler. I have recorded this in our bug tracking database as DPD200248341. We will try to backport the fix into 14.0 for you.

Judy

Thank you for the fix

发表评论

登录添加评论。还不是成员?立即加入