Unexpected compilation error occured while using std::make_tuple with std::unique_ptr

Unexpected compilation error occured while using std::make_tuple with std::unique_ptr

Hello.

I'm using Composer XE 2013 SP1 (version: 14.0.0 20130728).

I got an error, while compiling this code:

#include <tuple>
#include <memory>

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

Command line and comiper output is here:

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

/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)

If I compile this code with gcc compiler - there are no problem. What's wrong?

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