[llvm-bugs] [Bug 52474] New: list constructor does not use correct allocator
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Nov 10 18:45:42 PST 2021
https://bugs.llvm.org/show_bug.cgi?id=52474
Bug ID: 52474
Summary: list constructor does not use correct allocator
Product: libc++
Version: 11.0
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: edward.vogel at hpe.com
CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
If an allocator is not specified for a list constructor call, the allocator
used should be the lists allocator. It seems this is not the case for libc++
Consider the following from a cygwin cut/paste where the g++ library seems to
do the right thing, but libc++ does not:
$ cat t.cpp
#include <list>
#include <memory>
#include <cstdio>
struct myalloc : public std::allocator<int> {
myalloc() { printf("in ialloc\n"); }
};
int main(void)
{
// This should use the myalloc allocator, it does not
std::list<int,myalloc> c00((std::list<int,myalloc>::size_type) 3);
}
VogelEd at XLB3502Q4E ~
$ clang++ -o a.out t.cpp
VogelEd at XLB3502Q4E ~
$ ./a.out
in ialloc
VogelEd at XLB3502Q4E ~
$ clang++ -o a.out -stdlib=libc++ t.cpp
VogelEd at XLB3502Q4E ~
$ ./a.out
VogelEd at XLB3502Q4E ~
Not an important problem, but one found by our verification tests.
Thank you,
Ed Vogel
--
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/20211111/f9166c31/attachment.html>
More information about the llvm-bugs
mailing list