Skip to content

Instantly share code, notes, and snippets.

@chenfengyuan
Created December 31, 2013 04:34
Show Gist options
  • Save chenfengyuan/8192660 to your computer and use it in GitHub Desktop.
Save chenfengyuan/8192660 to your computer and use it in GitHub Desktop.
#include <tuple>
#include <memory>
int main(void){
using namespace std;
unique_ptr<char[]> a(new char[3]);
make_tuple(move(a));
}
@chenfengyuan
Copy link
Author

➜ cplusplus git:(master) ✗ make tuple.out
clang++ -std=c++11 -Wall -Wextra -stdlib=libc++ -O2 tuple.cc -o tuple.out -lboost_regex-mt -lboost_system-mt -lboost_thread-mt -ltcmalloc
In file included from tuple.cc:2:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:918:22: error: implicit instantiation of undefined template
'std::__1::__pointer_traits_element_type<std::__1::__tuple_leaf<0, std::__1::unique_ptr<char [], std::__1::default_delete<char []> >, false>, false>'
typedef typename __pointer_traits_element_type::type element_type;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:2451:54: note: in instantiation of template class
'std::__1::pointer_traits<std::__1::__tuple_leaf<0, std::__1::unique_ptr<char [], std::__1::default_delete<char []> >, false> >' requested here
bool = is_same<typename remove_cv<typename pointer_traits<_Ptr1>::element_type>::type,
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:2465:7: note: in instantiation of default argument for
'__same_or_less_cv_qualified_imp<std::__1::__tuple_leaf<0, std::__1::unique_ptr<char [], std::__1::default_delete<char []> >, false>, char _>' required here
: __same_or_less_cv_qualified_imp<_Ptr1, _Ptr2> {};
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:2732:42: note: in instantiation of template class
'std::__1::__same_or_less_cv_qualified<std::__1::__tuple_leaf<0, std::__1::unique_ptr<char [], std::__1::default_delete<char []> >, false>, char *, false>' requested here
class = typename enable_if<__same_or_less_cv_qualified<_Pp, pointer>::value>::type
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:2734:40: note: in instantiation of default argument for
'unique_ptr<std::__1::__tuple_leaf<0, std::__1::unique_ptr<char [], std::__1::default_delete<char []> >, false> >' required here
_LIBCPP_INLINE_VISIBILITY explicit unique_ptr(_Pp __p) _NOEXCEPT
^~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:2734:40: note: while substituting deduced template arguments into function
template 'unique_ptr' [with _Pp = std::__1::__tuple_leaf<0, std::__1::unique_ptr<char [], std::__1::default_delete<char []> >, false>, $1 = ]
_LIBCPP_INLINE_VISIBILITY explicit unique_ptr(_Pp __p) _NOEXCEPT
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits:1829:1: note: (skipping 2 contexts in backtrace; use
-ftemplate-backtrace-limit=0 to see all)
__is_constructible_test(_Tp&&, _Args&& ...);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits:1914:14: note: in instantiation of template class
'std::__1::__is_constructible_void_check<false, std::__1::unique_ptr<char [], std::__1::default_delete<char []> >, const std::__1::__tuple_leaf<0, std::__1::unique_ptr<char [],
std::__1::default_delete<char []> >, false> &>' requested here
: public __is_constructible_void_check<__contains_void<_Tp, _Args...>::value
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/tuple:260:42: note: in instantiation of template class
'std::__1::is_constructible<std::__1::unique_ptr<char [], std::__1::default_delete<char []> >, const std::__1::__tuple_leaf<0, std::__1::unique_ptr<char [],
std::__1::default_delete<char []> >, false> &>' requested here
class = typename enable_if<is_constructible<_Hp, _Tp>::value>::type>
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/tuple:262:18: note: in instantiation of default argument for '__tuple_leaf<const
std::__1::__tuple_leaf<0, std::__1::unique_ptr<char [], std::__1::default_delete<char []> >, false> &>' required here
explicit __tuple_leaf(_Tp&& __t) NOEXCEPT((is_nothrow_constructible<_Hp, _Tp>::value))
^~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/tuple:262:18: note: while substituting deduced template arguments into function
template '__tuple_leaf' [with _Tp = const std::__1::__tuple_leaf<0, std::__1::unique_ptr<char [], std::__1::default_delete<char []> >, false> &, $1 = ]
explicit __tuple_leaf(_Tp&& __t) NOEXCEPT((is_nothrow_constructible<_Hp, Tp>::value))
^
tuple.cc:7:5: note: in instantiation of function template specialization 'std::__1::make_tuple<std::__1::unique_ptr<char [], std::__1::default_delete<char []> > >' requested here
make_tuple(move(a));
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:704:8: note: template is declared here
struct __pointer_traits_element_type;
^
1 error generated.
make: *
* [tuple.out] Error 1
➜ cplusplus git:(master) ✗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment