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

            Bug ID: 41930
           Summary: shared_ptr requires allocator to have rebind template
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]

shared_ptr requires the allocator type in constructor overload 9
(http://eel.is/c++draft/util.smartptr.shared#const-9) to implement a rebind
template. I am not sure if this is a bug because the standard specifies that
the allocator must conform to "Cpp17Allocator", but the standard also
deprecates and removes rebind from std::allocator making it unable to be used
with shared_ptr. Here is an example:

// std::allocator no longer has `rebind` type
struct IntAlloc : std::allocator<int>
{};

{
    int* ptr = new int;
    std::shared_ptr<int> p(ptr, test_deleter<int>(3), IntAlloc());
}

The above code produces the error:

error: 'rebind' following the 'template' keyword does not refer to a template
    typedef typename _Tp::template rebind<_Up>::other type;
                                   ^~~~~~

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to