This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/65714] New: shared_ptr<void>::reset(p) blows a static_assertion
- From: "john.salmon at deshaw dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 09 Apr 2015 14:27:38 +0000
- Subject: [Bug libstdc++/65714] New: shared_ptr<void>::reset(p) blows a static_assertion
- Auto-submitted: auto-generated
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$