https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65714
Bug ID: 65714 Summary: shared_ptr<void>::reset(p) blows a static_assertion Product: gcc Version: 4.9.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: john.salmon at deshaw dot com The single-argument form of shared_ptr::reset fails with a static assertion when the pointer type is void. drdws0047$ cat spv.cpp #include <memory> #include <cstdlib> void foo(){ std::shared_ptr<void> spv( ::malloc(1024), ::free ); spv.reset(::malloc(2048)); // .../shared_ptr_base.h:874:4: error: static assertion failed: incomplete type spv.reset(::malloc(2048), ::free); // looks ok. } drdws0047$ dw -m gcc/4.9.2-30B/bin g++ -std=c++14 spv.cpp In file included from /proj/desrad-c/root/Linux/x86_64/gcc/4.9.2-30B/include/c++/4.9.2/bits/shared_ptr.h:52:0, from /proj/desrad-c/root/Linux/x86_64/gcc/4.9.2-30B/include/c++/4.9.2/memory:82, from spv.cpp:1: /proj/desrad-c/root/Linux/x86_64/gcc/4.9.2-30B/include/c++/4.9.2/bits/shared_ptr_base.h: In instantiation of ‘std::__shared_ptr<_Tp, _Lp>::__shared_ptr(_Tp1*) [with _Tp1 = void; _Tp = void; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2u]’: /proj/desrad-c/root/Linux/x86_64/gcc/4.9.2-30B/include/c++/4.9.2/bits/shared_ptr_base.h:1023:4: required from ‘void std::__shared_ptr<_Tp, _Lp>::reset(_Tp1*) [with _Tp1 = void; _Tp = void; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2u]’ spv.cpp:6:29: required from here /proj/desrad-c/root/Linux/x86_64/gcc/4.9.2-30B/include/c++/4.9.2/bits/shared_ptr_base.h:874:4: error: static assertion failed: incomplete type static_assert( !is_void<_Tp1>::value, "incomplete type" ); ^ drdws0047$