Issue |
81554
|
Summary |
odd behavior in std::map with an allocator with fancy pointers
|
Labels |
new issue
|
Assignees |
|
Reporter |
ilazaric
|
https://godbolt.org/z/xj63dcsGc
The point of the example is that `std::map` converts a raw pointer to a fancy pointer, when the raw pointer did not come from the allocator (it came from the stack)
This seems odd to me, a fancy pointer for a specific allocator is intended for memory related to that allocator (nullptr included)
The C++ standard, in the Cpp17Allocator requirement, specifies that `pointer_to(r)` has to work, but for specific references `r`, not all
Quoting:
* p denotes a value of type XX::pointer obtained by calling a1.allocate, where a1 == a
* r denotes a value of type T& obtained by the _expression_ *p
* -only mention of pointer_to- pointer_traits<XX::pointer>::pointer_to(r) -- same as p
Current libc++ implementation of std::map then implies that fancy pointers HAVE to also be able to contain unrelated addresses, which restricts certain (in my opinion reasonable) usecases, for example offset pointers for <4GB fixed memory, containing a 32bit offset
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs