Hello, everyone! I've discovered a bug similar to libstdc++/115939 in GCC. This bug exists for a while. Did someone face it too? I'd be glad to accept any advise. Thank you in advance!
C++ STL bug
Thanks for your post.
Could you please provide additional details about the bug? If possible, please include the code that reproduces the issue. This information will be invaluable in identifying a workaround or a fix promptly.
Do you get the same results with just the relevant code in a small test project? If so, please share a link to your test project. That'll help us better understand what's going on. If you're not familiar with preparing a test project, take a look at Creating a test project.
I'm sure many engineers here are looking forward to your simple focused project.
Albert Worldwide Developer Relations.
Thanks for an answer! Here's a test project:
#include <unordered_map>
#include <system_error>
#include <string_view>
#include <functional>
#include <expected>
int main(int argc, const char *argv[])
{
std::unordered_map<int, std::pair<int, std::function<std::expected<std::string_view, std::error_code>(void)>>>
var{ {24, {42, [] -> std::expected<std::string_view, std::error_code> { return "Hello, World!"; } }} };
const auto &it{var.find(24)};
if (it == var.end()) [[unlikely]]
return 1;
return 0;
}
Flags for Apple clang v21.0.0: -03, -std=c++26
If you need more details, feel free to ask me about them. I'll try to reply as soon as I can
@ultimatum Thank you for your response and the code. I apologize for any inconvenience, but I would like to request that you provide the project, including all flags and the environmental settings, so that it is ready for download.
Additionally, I would appreciate it if you could review the following documentation that explains how to create and share those:
https://developer.apple.com/forums/thread/756223
Thank you for your assistance. I am eager to reproduce the issue and work towards resolving it promptly.
Albert Worldwide Developer Relations.
Sorry for not creating the project appropriately! Here's the link: https://disk.yandex.ru/d/gDzkLLdlOrZQAg
Thanks for the link.
Just opening your project in Xcode latest release I get a few errors. Please make sure the project and code are ready for reviewing. Thanks
/test/test/main.cpp:20:12 Invalid operands to binary expression ('const iterator' (aka 'const __hash_map_iterator<__hash_iterator<std::__hash_node<std::__hash_value_type<int, std::pair<int, std::function<std::expected<std::string_view, std::error_code> ()>>>, void *> *>>') and 'iterator' (aka '__hash_map_iterator<__hash_iterator<std::__hash_node<std::__hash_value_type<int, std::pair<int, std::function<std::expected<std::string_view, std::error_code> ()>>>, void *> *>>'))
c++/v1/__expected/expected.h:1169:49 Satisfaction of constraint 'requires { { *__x == __v } -> __core_convertible_to<bool>; }' depends on itself
Albert Worldwide Developer Relations.
That's the thing. This code should compile, but it doesn't. It compiles with Apple clang v17, but the latest clang (v21) makes things different... Problem probably hides in latest STL library.
Got it! Let's file a bug for that and we can route it to the clang team.
Once you open the bug report, please post the FB number here for my reference.
If you have any questions about filing a bug report, take a look at Bug Reporting: How and Why?
Make sure the bug contains the project attached and zipped.
Albert Worldwide Developer Relations.
Thanks for your help! I successfully sent my report. Here's the number: FB22882385
@ultimatum Thanks for doing this. The bug will be routed to the correct team and give them sometime to review it, with that focused project and the comments iI'm sure they'll come back to you quickly.
You can see the status of your feedback in Feedback Assistant. There, you can track if the report is still being investigated, has a potential identifiable fix, or has been resolved in another way. The status appears beside the label "Resolution." We're unable to share any updates on specific reports on the forums.
For more details on when you'll see updates to your report, please see What to expect after submission.
Albert Worldwide Developer Relations.