https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118341
Bug ID: 118341 Summary: Missing -D_GLIBCXX_ASSERTIONS checks for <bitset> Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: sjames at gcc dot gnu.org Target Milestone: --- Inspired by https://github.com/llvm/llvm-project/pull/120685. With -D_GLIBCXX_ASSERTIONS, the const cases below don't trigger an assertion, neither does c[4]. ``` #define _GLIBCXX_ASSERTIONS /* Cut down version of https://github.com/llvm/llvm-project/pull/120685 */ #include <bitset> int main(int, char**) { { // Empty bitset std::bitset<0> c; const auto& const_c = c; const_c[0]; const_c[42]; } { // Non-empty bitset std::bitset<4> c(42); const auto& const_c = c; c[4]; const_c[4]; } return 0; } ``` godbolt: https://godbolt.org/z/rEdaWxW3E