-
Notifications
You must be signed in to change notification settings - Fork 11.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[libc++] undefined behaviour in std::set/std::map/std::unordered_set/std::unordered_map #102547
Comments
(lines can be a little different in screenshots as it's my constexpr branch) |
Possibly off-topic: I attempted to add
It's not yet possible to avoid core UB in modification of the key which is a const subobject. CWG2514 is related. Maybe related: [class.cdtor]/1 and CWG1517. Perhaps we should to start the lifetime of the node first and wrap the element into a I don't understand why can't we refer to these subobjects (evaluate the member access expression?) before construction even if virtual base class is not involved. BTW, you can use permanent links to show the code in the Github UI. llvm-project/libcxx/include/__tree Lines 1808 to 1815 in 00139ae
llvm-project/libcxx/include/__hash_table Lines 1813 to 1820 in 00139ae
|
I was implementing P3372 (constexpr containers and adaptors) in libc++ and found UB which fails evaluation in ExprConstant.cpp.
It's in these two files:
libcxx/include/__tree
libcxx/include/__hash_table
(link is to the locations of problems)
These are similar issue where a node / bucket is allocated, but NOT constructed, and then a subobject is constructed.
The text was updated successfully, but these errors were encountered: