Skip to content

Commit

Permalink
New issue from Jiang An: "Static data members of ctype_base are not y…
Browse files Browse the repository at this point in the history
…et required to be usable in constant expressions"
  • Loading branch information
Dani-Hub committed Jan 14, 2024
1 parent 453e996 commit e940571
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions xml/issue4037.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version='1.0' encoding='utf-8' standalone='no'?>
<!DOCTYPE issue SYSTEM "lwg-issue.dtd">

<issue num="4037" status="New">
<title>Static data members of <tt>ctype_base</tt> are not yet required to be usable in constant expressions</title>
<section><sref ref="[category.ctype.general]"/></section>
<submitter>Jiang An</submitter>
<date>12 Jan 2024</date>
<priority>99</priority>

<discussion>
<p>
It may be desired that static data members <tt>ctype_base</tt> are "real constants", i.e. usable in constant expressions.
However, this is not strictly required because <tt>mask</tt> is only required to be a bitmask type that can be a class type,
which makes the plain <tt>const</tt> potentially insufficient.
</p>
</discussion>

<resolution>
<p>
This wording is relative to <paper num="N4971"/>.
</p>

<ol>

<li><p>Modify <sref ref="[category.ctype.general]"/> 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 mask is a bitmask type (<sref ref="[bitmask.types]"/>).
</p>
</blockquote>


</li>

</ol>


</resolution>

</issue>

0 comments on commit e940571

Please sign in to comment.