This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.

4186. regex_traits::transform_primary mistakenly detects typeid of a function

Section: 28.6.6 [re.traits] Status: New Submitter: Jiang An Opened: 2024-12-18 Last modified: 2024-12-21

Priority: Not Prioritized

View other active issues in [re.traits].

View all other issues in [re.traits].

View all issues with New status.

Discussion:

28.6.6 [re.traits]/7 currently says typeid(use_facet<collate<charT>>) == typeid(collate_byname<charT>), which is always false because use_facet<collate<charT>> is a function template specialization while collate_byname<charT> is a class template specialization. This looks like misuse, and has been present in TR1 (N1836).

Presumably the intended operand is use_facet<collate<charT>>(getloc()).

Proposed resolution:

This wording is relative to N5001.

  1. Modify 28.6.6 [re.traits] as indicated:

    template<class ForwardIterator>
      string_type transform_primary(ForwardIterator first, ForwardIterator last) const;
    

    -7- Effects: If

    typeid(use_facet<collate<charT>>(getloc())) == typeid(collate_byname<charT>)
    

    and the form of the sort key returned by collate_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.