Skip to content

Commit

Permalink
New issue from Jiang An: "Constants in std::regex_constants should be…
Browse files Browse the repository at this point in the history
… allowed to be enumerators"
  • Loading branch information
Dani-Hub committed Oct 21, 2023
1 parent 949c4e4 commit 4f0c72d
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions xml/issue3998.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version='1.0' encoding='utf-8' standalone='no'?>
<!DOCTYPE issue SYSTEM "lwg-issue.dtd">

<issue num="3998" status="New">
<title>Constants in <tt>std::regex_constants</tt> should be allowed to be enumerators</title>
<section><sref ref="[re.const]"/></section>
<submitter>Jiang An</submitter>
<date>18 Oct 2023</date>
<priority>99</priority>

<discussion>
<p>
Currently, MSVC STL and libc++ implement constants in <tt>std::regex_constants</tt> as
enumerators of unscoped enumerations, while the standard specify them to be <tt>constexpr</tt> variables.
<p/>
<a href="https://github.com/microsoft/STL/issues/4100#issuecomment-1767717721">Casey Carter argued</a>
that it would be better to make these constants prvalues to avoid wasting space in object files. And
presumably almost all users just use their values without odr-using them or relying on their value category.
<p/>
Perhaps we should allow these constants to be enumerators of the corresponding type (<tt>syntax_option_type</tt>,
<tt>match_flag_type</tt>, or <tt>error_type</tt>) if the corresponding type is an enumeration.
<p/>
Notes: since C++20, we can even make the enumeration types scoped and expose the enumerators to the
namespace by using-declaration or using-enum-declaration. <paper num="P0439R0"/> might be related,
since it changed former enumerators to <tt>constexpr</tt> variables.
</p>
</discussion>

<resolution>
</resolution>

</issue>

0 comments on commit 4f0c72d

Please sign in to comment.