[llvm-bugs] [Bug 37637] New: shared_ptr cannot be constructed with a move-only deleter

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 31 02:12:05 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=37637

            Bug ID: 37637
           Summary: shared_ptr cannot be constructed with a move-only
                    deleter
           Product: libc++
           Version: 5.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: anthony at justsoftwaresolutions.co.uk
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

Created attachment 20363
  --> https://bugs.llvm.org/attachment.cgi?id=20363&action=edit
Sample file that demonstrates the bug

Compiling the attached file with the below command fails with the error message
below. This should work, as per [util.smartptr.shared.const]p9/13

Compilation succeeds as expected with -stdlib=libstdc++

clang++-5.0 -std=c++17 -stdlib=libc++ move-only-deleter.cpp 


In file included from move-only-deleter.cpp:1:
/usr/include/c++/v1/memory:3981:39: error: call to deleted constructor of
'Deleter'
        __cntrl_ = new _CntrlBlk(__p, __d, _AllocT());
                                      ^~~
move-only-deleter.cpp:17:5: note: in instantiation of function template
specialization 'std::__1::shared_ptr<int>::shared_ptr<int, Deleter>' requested
here
    std::shared_ptr<int>(new int,Deleter());
    ^
move-only-deleter.cpp:6:5: note: 'Deleter' has been explicitly marked deleted
here
    Deleter(Deleter const&)=delete;
    ^
/usr/include/c++/v1/memory:3507:39: note: passing argument to parameter '__d'
here
    __shared_ptr_pointer(_Tp __p, _Dp __d, _Alloc __a)
                                      ^
1 error generated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180531/d1398417/attachment-0001.html>


More information about the llvm-bugs mailing list