P3969

Fixing std::bit_cast of types with padding bits

R3

When bit-casting a type containing padding bits to a type with no padding bits, `std::bit_cast` degenerates into an alternative spelling for `std::unreachable` (some exceptions apply). To prevent this inadvertent footgun, this proposal makes that degenerate form of `std::bit_cast` ill-formed.

Authors
Jan Schultke
Mailing
2026-10
Doc date
2026-10-04
Audience
LEWG

Revision history

  1. 2026-10
    R3 Selected (shown above)
  2. 2026-07

    Fixing std::bit_cast of types with padding bits

    P
  3. 2026-05
    R1 EWGLEWG

    Fixing std::bit_cast of types with padding bits

  4. 2026-02
    R0 LEWG

    Fixing std::bit_cast of types with padding bits