<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 4037: Static data members of ctype_base are not yet required to be usable in constant expressions</title>
<meta property="og:title" content="Issue 4037: Static data members of ctype_base are not yet required to be usable in constant expressions">
<meta property="og:description" content="C++ library issue. Status: WP">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue4037.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#WP">WP</a> status.</em></p>
<h3 id="4037"><a href="lwg-defects.html#4037">4037</a>. Static data members of <code>ctype_base</code> are not yet required to be usable in constant expressions</h3>
<p><b>Section:</b> 28.3.4.2.1 <a href="https://wg21.link/category.ctype.general">[category.ctype.general]</a> <b>Status:</b> <a href="lwg-active.html#WP">WP</a>
 <b>Submitter:</b> Jiang An <b>Opened:</b> 2024-01-12 <b>Last modified:</b> 2024-04-02</p>
<p><b>Priority: </b>Not Prioritized
</p>
<p><b>View all issues with</b> <a href="lwg-status.html#WP">WP</a> status.</p>
<p><b>Discussion:</b></p>
<p>
It may be desired that static data members <code>ctype_base</code> are "real constants", i.e. usable in constant expressions. 
However, this is not strictly required because <code>mask</code> is only required to be a bitmask type that can be a class type, 
which makes the plain <code>const</code> potentially insufficient.
</p>

<p><i>[2024-03-12; Reflector poll]</i></p>

<p>
Set status to Tentatively Ready after five votes in favour during reflector poll.
</p>

<p><i>[Tokyo 2024-03-23; Status changed: Voting &rarr; WP.]</i></p>



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

<ol>

<li><p>Modify 28.3.4.2.1 <a href="https://wg21.link/category.ctype.general">[category.ctype.general]</a> as indicated:</p>

<blockquote>
<blockquote>
<pre>
namespace std {
  class ctype_base {
  public:
    using mask = <i>see below</i>;

    // <i>numeric values are for exposition only.</i>
    static const<ins>expr</ins> mask space  = 1 &lt;&lt; 0;
    static const<ins>expr</ins> mask print  = 1 &lt;&lt; 1;
    static const<ins>expr</ins> mask cntrl  = 1 &lt;&lt; 2;
    static const<ins>expr</ins> mask upper  = 1 &lt;&lt; 3;
    static const<ins>expr</ins> mask lower  = 1 &lt;&lt; 4;
    static const<ins>expr</ins> mask alpha  = 1 &lt;&lt; 5;
    static const<ins>expr</ins> mask digit  = 1 &lt;&lt; 6;
    static const<ins>expr</ins> mask punct  = 1 &lt;&lt; 7;
    static const<ins>expr</ins> mask xdigit = 1 &lt;&lt; 8;
    static const<ins>expr</ins> mask blank  = 1 &lt;&lt; 9;
    static const<ins>expr</ins> mask alnum  = alpha | digit;
    static const<ins>expr</ins> mask graph  = alnum | punct;
  };
}
</pre>
</blockquote>
<p>
-1- The type <code>mask</code> is a bitmask type (16.3.3.3.3 <a href="https://wg21.link/bitmask.types">[bitmask.types]</a>).
</p>
</blockquote>


</li>

</ol>







</body>
</html>
