r/cpp
•
u/eisenwave
WG21 Member
•
Mar 30 '26
•
1
C++26/C++29: Progress report for my papers seen during the Croydon meeting and before
Hi all, this is a report of what is going on with my papers during the 2026-03 WG21 meeting in Croydon, and during the telecons leading up to it. I think this report adds quite a lot of value since the broader-scale trip report by Herb Sutter tends to focus more on the large features being delivered, rather than the many smaller improvements I tend to work on.
I've had a great time this meeting, and made an immense amount of progress. Many of my C++29 papers made some progress, and all papers targeting C++26 were accepted. It was a resounding success.
⏩ P3666R3 Bit-precise integers
This paper introduces _BitInt(N) types (bit-precise integers) into C++, for compatibility with C23.
The feature made it through EWG with flying colors. While some of the design was questioned, such as the ugly _BitInt keyword and the not-so-useful limit of BITINT_MAXWIDTH to be 64 (or LLONG_WIDTH), I did a great job defending the design of the paper, and it got forwarded to CWG with strong consensus.
In LEWG, _BitInt could not shed its nature of being a "C compatibility feature", and the proposed library impact of P3666 was deemed way too large. Consequently, LEWG voted to outright prevent _BitInt from receiving any library support, and voted for std::is_integral_v<_BitInt(N)> to be false. In hindsight, the latter restriction goes too far, and I will relitigate it. std::is_integral_v<_ExtInt(N)> would be true for some N-bit extended integer, if Clang's _BitInt was still spelled _ExtInt and considered an extended integer type. It makes no sense to treat bit-precise integers differently because std::is_integral_v is already a blank cheque for the implementation to extend the trait.
In any case, the finish line is in sight. I think it's possible to forward P3666 from LEWG to LWG next meeting, and have it in the standard in 2026.
⏩ P3688R6 ASCII character utilities
This one was not seen during the meeting, but during SG16 telecons before Croydon. After a bit of back and forth and some design and wording feedback, it was forwarded to LEWG.
⏩ P3695R3 Deprecate implicit conversions between char8_t and char16_t or char32_t
As the title says, the goal is to deprecate some bug-prone implicit conversions. The paper was forwarded from SG16 during telecons to EWG, but it would be best to put some more work into the paper and implement the warning exactly as proposed in Clang before proceeding with standardization.
Before Croydon, LEWG looked at this paper, which adds several functions such as std::div_to_neg_inf for integer division with rounding toward negative infinity. While the overall interface remains contentious and while some people were missing a std::div_euclid function (for Euclidean rounding), it should be possible to make progress with a bit more discussion and design adjustments.
LEWG will see the paper again at some point, likely in Brno.
⏩ P3764R0 A utility function for propagating the most significant bit
The paper adds a single std::msb_to_mask function which "broadcasts" the uppermost bit, i.e. returns a bit mask where every bit has the value of the most significant bit. SG6 gave some feedback regarding motivation and naming, and forwarded to LEWG.
⏳ P3876R1 Extending <charconv> support to more character types
SG16 looked at this paper before Croydon, and we just barely didn't have time to complete the review. The paper adds support for char8_t and other character types to std::to_chars and std::from_chars. This is an important stepping stone towards Unicode support in the standard library because it enables std::format to work with char8_t format strings in the future as well.
I suspect we will finish the review during telecons soon, and the paper will make it to LEWG.
⏩ P3899R1 Clarify the behavior of floating-point overflow
Here, the almost comical compiler divergence for floating-point arithmetic during constant evaluation is addressed. Some compilers consider overflow not to be a constant expression, some do. There are also some major wording issues. The design is to standardize the GCC behavior: floating-point overflow (to infinity) is not a constant expression, and neither is an invalid operation that produces NaN, nor an operation on signaling NaN; anything else is fine, such as underflow.
SG6 forwarded the paper and so did EWG. I would expect this to be in C++29.
However, the overarching task of fixing the floating-point specification is not anywhere near done. Little to no work has taken place here in 30 years, and it's showing.
⏳ P3969R0 Fixing std::bit_cast for types with padding bits
The paper deals with the problem that some uses of std::bit_cast have undefined behavior for all inputs. That is because padding bits are mapped into non-padding bits in the destination. This paper was seen by LEWG before the meeting, and by EWG during the meeting. Interestingly, there seem to be conflicting opinions: LEWG is concerned about silently changing the behavior of std::bit_cast, wheras EWG does not want another flavor of std::bit_cast (like the paper propses).
The common ground here is that std::bit_cast should be made safer, which can be done by adding a static_assert that checks for unconditional UB, without changing the behavior of the function otherwise, and without proposing any additional function. That will be the direction for the paper going forward.
⏩ P3935R0 Rebasing <cmath> on C23
The goal is to introduce all the new C23 functions added to the <math.h> header into C++. SG6 gave some feedback and forwarded to LEWG. SG22 still needs to examine the paper.
✅ P3924R1 Fix inappropriate font choices for "declaration"
This paper resolves NB comment US 11-400. There is no designing here, only fixing some bugs in core wording. The paper was accepted into C++26.
✅ P4037R1 Supporting signed char and unsigned char in random number generation
This paper resolves NB comment RU-272. The problem is that using std::uniform_int_distribution<std::uint8_t> is undefined behavior, but producing random 8-bit integers is useful, especially for fuzz testing. The paper was accepted into C++26.
✅ P4052R0 Renaming saturation arithmetic functions
This paper resolves NB comment FR-026-265. The names add_sat and saturate_cast are not great, and the paper renames them to saturating_add and saturating_cast, respectively. This creates consistency with the naming scheme that Rust uses for such operations, and it chooses the globally most popular naming scheme for saturation arithmetic.
I honestly expected the rename to be far more contentious, but it seemed like no one in LEWG strongly preferred the old names. Thus, the paper was accepted into C++26.
✅ CWG3129 Clarify which floating-point-literals are valid
Compilers diverge on whether the literal 1e100000000000000000000000000000000000000000000000f is valid; GCC and Clang consider it to be infinity, and MSVC considers it invalid. While the wording is clear, the design is accidental fallout from a previous core issue. I got the impression that not much would happen (and who knows when) if I didn't get involved. EWG also looked at the floating-point clarification paper the same meeting, so this CWG issue was a perfect fit.
At break-neck speed, on Friday, SG6, EWG, then CWG looked at the issue and merged it into C++26 with no changes. The key argument in favor of treating this literal as infinity is that it would otherwise be invalid at the lexer level, so not even some if constexpr test involving std::numeric_limits could get rid of an invalid literal. This is annoying considering that floating-point types may vary in size from platform to platform.
Whenever you write a floating-point literal and get infinity instead, you can thank me personally 😎. While that behavior is deeply surprising, compilers treat it as a warning, so you would likely notice it.
2
u/parkotron Mar 30 '26
This link for P3666R3 should be: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2026/p3666r3.html
9
u/Dragdu Mar 30 '26
LEWG WTF?
2
u/Plazmatic Mar 30 '26
Can someone explain to me why
is true? I don't understand why this isn't an issue for uint16?
9
u/parkotron Mar 30 '26 edited Mar 30 '26
I like the ASCII functions. Sure “real” Unicode support in the standard library would be great, but that’s no reason not to provide sane ASCII support.
Personally though, I don’t love
ascii_is_digithaving two overloads. Given the existence of the other, base-specific functions I think it would be more consistent to split them up and give them distinct names. They just feel like separate operations to me.Possibilities include:
ascii_is_digitandascii_is_decimal_digit: The latter is consisent withascii_is_octal_digitandascii_is_hexadecimal_digit.ascii_is_digit_of_baseandascii_is_digit: This gives the most common operation the shorter name and the rarer, most complicated and slowest operation the more explicit name.11
u/James20k P2005R0 Mar 30 '26
Congrats on the papers!
Floating point is definitely one of the more crazy parts of the standard. People always think that the standard gives much stronger guarantees than it actually does, and make bold assumptions like "the spec is implementable"
I'll throw a party for you every time another piece of behaviour is nailed down to actually be the same across every compiler
4
u/F54280 Mar 30 '26
This is amazing grunt work. Love it. Thanks for your efforts in making C++ better!
1
u/Wild_Meeting1428 Apr 07 '26
Do you know why the original authors of _BitInt in C defined, that adding two _BitInt's doesn't extend the bit width of the result? _BitInt's origin are HDLs and there every operation of an integral type extends the bit width of the result to the maximum required bit width.
I would've expected this behavior as well, even if it would be inconsistent with integer promotion rules.
3
u/biowpn Mar 30 '26
I really like your work here. They will solve quite a few important problems in my domain!
3
u/ContDiArco Mar 30 '26 edited Mar 30 '26
This is the hero stuff! Thanks a lot...
2
u/VinnieFalco wg21.org | corosio.org Mar 30 '26
It was great to finally meet you in person, and congratulations on your repeated successes in the rooms :)
2
u/fdwr fdwr@github 🔍 Mar 30 '26
Oh man, that would certainly clean up parts of the codebase, notably a
wchar_tto_charsfor displaying numbers in Windows UI, and some places using u8 withstd::format(requiring unfortunate casts).Doh, that would be convenient.
Nicely more consistent now. Such little divergences lead to us trying to type things like
add_saturateorsat_cast, then getting a bewildering build failure.1
u/whooomeeehh Aug 09 '26
Croydon ?? Really ?? Why not here in Canary Wharf where we do still use C++ ??
1
u/wannaliveonmars Mar 30 '26
I'm on Ubuntu. How do I download C++26 to experiment on it? I became a bit interested, since I used C++ a lot 10 years ago. Do I download a newer version of gcc or what?