This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/58839] New: Regression: dereferencing void in shared_ptr(unique_ptr&& u) constructor


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>

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]