C++ STL bug

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!

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.

C++ STL bug
 
 
Q