To give context of what I'm talking about, the following program correctly prints true when compiled with clang++/libc++
#include <iostream>
#include <regex>
int main()
{
std::locale::global(std::locale("en_US.UTF-8"));
std::wstring str = L"AÀÁÂÃÄÅaàáâãäå";
std::wregex re(L"[[=a=]]*", std::regex::basic);
std::cout << std::boolalpha << std::regex_match(str, re) << '\n';
}
however, I can't quite understand the description of std::regex_traits::transform_primary() in the standard (through which [=a=] is handled). To quote 28.7[re.traits]/7:
if
typeid(use_facet<collate<charT> >) == typeid(collate_byname<charT>)and the form of the sort key returned bycollate_byname<charT>::transform(first, last)is known and can be converted into a primary sort key then returns that key, otherwise returns an empty string.
The original proposal explains that the standard regex_traits::transform_primary() can only work if the collate facet in the imbued locale was not replaced by the user (that's the only way it can know how to convert the result of collate::transform() to the equivalence key).
My question is, how is the typeid comparison in the standard supposed to ensure that? Does it imply that all system-supplied facets pulled out of locales with use_facet have _byname as their true dynamic types?