std::char_traits
is totally underspecifiedSection: 27.2.2 [char.traits.require] Status: New Submitter: Jiang An Opened: 2024-09-08 Last modified: 2025-02-07
Priority: 4
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".
[2025-02-07; Reflector poll]
Set priority to 4 after reflector poll.
27.2.1 [char.traits.general]/1 says that the subclause
"defines a class template char_traits<charT>
",
but we never provided a definition.
"Libc++ started to warn that the primary template is deprecated and will be removed. The proposed resolution doesn't improve matters though."
"The definition should be cross-platform. Unspecified doesn't help."
Proposed resolution:
This wording is relative to N4988.
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 ofchar_traits
is unspecified and possibly makes the program ill-formed.