static analyzer error in std::sort

I'm getting a static analysis warning on the following code. I don't think it could be my error, but I guess it's more likely a static analysis false positive than a C++ standard library bug. The warning says "Method called on moved-from object of type 'std::basic_string'". Tested in Xcode 26.5 RC. Reported as FB22735405.

#include <algorithm>
#include <string>
#include <vector>

#include <CoreFoundation/CoreFoundation.h>

template <
		class traits = std::char_traits<char>,
        class Allocator = std::allocator<char> >
struct UTF8StringLess
{
	bool	operator()(
		const std::basic_string<char, traits, Allocator>& inFirst,
		const std::basic_string<char, traits, Allocator>& inSecond ) const;
};

template<class traits, class Allocator>
inline bool	UTF8StringLess<traits, Allocator>::operator()(
		const std::basic_string<char, traits, Allocator>& inFirst,
		const std::basic_string<char, traits, Allocator>& inSecond ) const
{
	CFStringRef	theFirst = ::CFStringCreateWithCString( nullptr, inFirst.c_str(),
		kCFStringEncodingUTF8 );
	CFStringRef	theSecond = ::CFStringCreateWithCString( nullptr, inSecond.c_str(),
		kCFStringEncodingUTF8 );
	
	CFComparisonResult	compResult = ::CFStringCompare( theFirst, theSecond,
		kCFCompareCaseInsensitive );
	bool	isLess = (compResult == kCFCompareLessThan);
	
	::CFRelease( theFirst );
	::CFRelease( theSecond );
	
	return isLess;
}


int main(int argc, const char * argv[])
{
	std::vector<std::string> names{ "obey", "Zorro", "can" };
	
	std::sort( names.begin(), names.end(), UTF8StringLess() );
	
	return EXIT_SUCCESS;
}

Thanks for the post, that looks like a clang issue to me. Is that for line 22? You can suppress the warning locally so it doesn't clutter your build with #ifndef __clang_analyzer__

There are many awesome C++ engineers here that I'm sure they'll be able to figure it out, but seems an error from clang. Or is the warning triggered by the cplusplus.Move?

Can you post the output box warnings and errors?

Thanks Albert
  Worldwide Developer Relations.

@DTS Engineer The error points to line 24. I'm not sure what you mean by "output box", but here is a screenshot of the Issue Navigator.

For what it's worth, I produced a shorter program that no longer depends on CoreFoundation but still produces the same static analyzer warning.

#include <algorithm>
#include <string>
#include <strings.h>
#include <vector>

int main(int argc, const char * argv[])
{
	std::vector<std::string> names{ "obey", "Zorro", "can" };
	
	std::sort( names.begin(), names.end(),
		[](const std::string& a, const std::string& b)
		{
			return strcasecmp( a.c_str(), b.c_str() ) < 0;
		} );
	
	return EXIT_SUCCESS;
}
static analyzer error in std::sort
 
 
Q