This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/58839] New: Regression: dereferencing void in shared_ptr(unique_ptr&& u) constructor
- From: "mrlika at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 22 Oct 2013 10:23:09 +0000
- Subject: [Bug libstdc++/58839] New: Regression: dereferencing void in shared_ptr(unique_ptr&& u) constructor
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58839
Bug ID: 58839
Summary: Regression: dereferencing void in
shared_ptr(unique_ptr&& u) constructor
Product: gcc
Version: 4.8.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: mrlika at gmail dot com
This completely valid C++11 code does not compile when T is void.
template <typename T>
void f() {
std::unique_ptr<T> sp;
std::shared_ptr<T> up(std::move(sp));
}
int main() {
f<char>();
//f<void>(); // Error /usr/include/c++/4.8/bits/shared_ptr_base.h:851:34:
error: âstd::unique_ptr<void, std::default_delete<void> >::pointer {aka void*}â
is not a pointer-to-object type
}
This bug makes impossible to use shared_ptr constructor that takes unique_ptr
rvalue reference as a parameter with type of pointer T=void.
This is regression appeared after changing line in shared_ptr_base.h from
_Tp1* __tmp = __r.get();
to
auto __tmp = std::__addressof(*__r.get());
in the following commit:
2012-11-07 paolo 2012-11-07 Paolo Carlini <paolo.carlini@oracle.com>