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.

4152. The primary template of std::char_traits is totally underspecified

Section: 27.2.2 [char.traits.require] Status: New Submitter: Jiang An Opened: 2024-09-08 Last modified: 2024-09-08

Priority: Not Prioritized

View other active issues in [char.traits.require].

View all other issues in [char.traits.require].

View all issues with New status.

Discussion:

Currently, only explicit specializations of std::char_traits are specified in the standard. Nothing is specified for the primary template except that it's not marked "not defined".

Given some implementations provide the definition of the primary template (perhaps as an extension), it might be better to explicitly say that instantiation of the primary template has unspecified effect. Also, it seems outdated to say "explicit specializations" as partial specializations are possible since C++20.

Proposed resolution:

This wording is relative to N4988.

  1. Modify 27.2.2 [char.traits.require] as indicated:

    -2- The class template

    template<class charT> struct char_traits;
    

    is provided in the header <string> as a basis for explicit and partial specializations. The effect of instantiating the primary template of char_traits is unspecified and possibly makes the program ill-formed.