[llvm-bugs] [Bug 41930] New: shared_ptr requires allocator to have rebind template
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat May 18 10:50:38 PDT 2019
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: unassignedclangbugs at nondot.org
Reporter: z.zoelec2 at gmail.com
CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190518/a23db611/attachment-0001.html>
More information about the llvm-bugs
mailing list