<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 4152: The primary template of std::char_traits is totally underspecified</title>
<meta property="og:title" content="Issue 4152: The primary template of std::char_traits is totally underspecified">
<meta property="og:description" content="C++ library issue. Status: New">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue4152.html">
<meta property="og:type" content="website">
<meta property="og:image" content="http://cplusplus.github.io/LWG/images/cpp_logo.png">
<meta property="og:image:alt" content="C++ logo">
<style>
  p {text-align:justify}
  li {text-align:justify}
  pre code.backtick::before { content: "`" }
  pre code.backtick::after { content: "`" }
  blockquote.note
  {
    background-color:#E0E0E0;
    padding-left: 15px;
    padding-right: 15px;
    padding-top: 1px;
    padding-bottom: 1px;
  }
  ins {background-color:#A0FFA0}
  del {background-color:#FFA0A0}
  table.issues-index { border: 1px solid; border-collapse: collapse; }
  table.issues-index th { text-align: center; padding: 4px; border: 1px solid; }
  table.issues-index td { padding: 4px; border: 1px solid; }
  table.issues-index td:nth-child(1) { text-align: right; }
  table.issues-index td:nth-child(2) { text-align: left; }
  table.issues-index td:nth-child(3) { text-align: left; }
  table.issues-index td:nth-child(4) { text-align: left; }
  table.issues-index td:nth-child(5) { text-align: center; }
  table.issues-index td:nth-child(6) { text-align: center; }
  table.issues-index td:nth-child(7) { text-align: left; }
  table.issues-index td:nth-child(5) span.no-pr { color: red; }
  @media (prefers-color-scheme: dark) {
     html {
        color: #ddd;
        background-color: black;
     }
     ins {
        background-color: #225522
     }
     del {
        background-color: #662222
     }
     a {
        color: #6af
     }
     a:visited {
        color: #6af
     }
     blockquote.note
     {
        background-color: rgba(255, 255, 255, .10)
     }
  }
</style>
</head>
<body>
<hr>
<p><em>This page is a snapshot from the LWG issues list, see the <a href="lwg-active.html">Library Active Issues List</a> for more information and the meaning of <a href="lwg-active.html#New">New</a> status.</em></p>
<h3 id="4152"><a href="lwg-active.html#4152">4152</a>. The primary template of <code>std::char_traits</code> is totally underspecified</h3>
<p><b>Section:</b> 27.2.2 <a href="https://wg21.link/char.traits.require">[char.traits.require]</a> <b>Status:</b> <a href="lwg-active.html#New">New</a>
 <b>Submitter:</b> Jiang An <b>Opened:</b> 2024-09-08 <b>Last modified:</b> 2025-02-07</p>
<p><b>Priority: </b>4
</p>
<p><b>View other</b> <a href="lwg-index-open.html#char.traits.require">active issues</a> in [char.traits.require].</p>
<p><b>View all other</b> <a href="lwg-index.html#char.traits.require">issues</a> in [char.traits.require].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#New">New</a> status.</p>
<p><b>Discussion:</b></p>
<p>
Currently, only explicit specializations of <code>std::char_traits</code> are specified in the standard. 
Nothing is specified for the primary template except that it's not marked "not defined".
<p/>
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.
</p>

<p><i>[2025-02-07; Reflector poll]</i></p>

<p>
Set priority to 4 after reflector poll.
</p>
<p>
27.2.1 <a href="https://wg21.link/char.traits.general">[char.traits.general]</a>/1 says that the subclause
"defines a class template <code>char_traits&lt;charT&gt;</code>",
but we never provided a definition.
</p>
<p>
"Libc++ started to warn that the primary template is deprecated and will
be removed. The proposed resolution doesn't improve matters though."
</p>
<p>
"The definition should be cross-platform. Unspecified doesn't help."
</p>



<p id="res-4152"><b>Proposed resolution:</b></p>
<p>
This wording is relative to <a href="https://wg21.link/N4988" title=" Working Draft, Programming Languages — C++">N4988</a>.
</p>

<ol>
<li><p>Modify 27.2.2 <a href="https://wg21.link/char.traits.require">[char.traits.require]</a> as indicated:</p>

<blockquote>
<p>
-2- The class template
</p>
<blockquote><pre>
template&lt;class charT&gt; struct char_traits;
</pre></blockquote>
<p>
is provided in the header <code>&lt;string&gt;</code> as a basis for explicit <ins>and partial</ins> 
specializations. <ins>The effect of instantiating the primary template of <code>char_traits</code> is unspecified 
and possibly makes the program ill-formed.</ins>
</p>
</blockquote>
</li>

</ol>






</body>
</html>
