https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65714
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- The standard says s.reset(p) is equivalent to shared_ptr(p).swap(s) and shared_ptr(p) requires that p is a pointer to a complete type. A void* is not a pointer to a complete type. If your code compiled it would end up calling 'delete' on a void*, which is invalid, and would not be suitable for memory allocated by malloc() anyway.