[libcxx-commits] [libcxx] [libc++] Simplify __bitset::__init (PR #121357)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Sat May 17 12:48:44 PDT 2025


philnik777 wrote:

> After several attempts with a [stage1 (generic-gcc, gcc-14, g++-14) CI failure](https://github.com/llvm/llvm-project/actions/runs/13570938788/job/37935502660?pr=121357#logs), I realized that we still have to keep the initialization of the `__first_` array in the constructor initializer list, because the constructor is `constexpr` since C++11, whereas C++11 `constexpr` constructor body does not allow statements other than the following: null statements, `static_assert`, `typedef` or alias declarations, using declarations/directives (https://en.cppreference.com/w/cpp/language/constexpr). Thus, gcc is unable to compile it ([A reproducer](https://godbolt.org/z/n99666xf5)) and that's why the generic-gcc CI fails.
> 
> Given this limitation, it seems that we still have to move the initialization back to the constructor initializer list. Since C++03 does not support `{}` in the constructor initializer list, I think we still need to keep the `__init` function for C++03. Please let me know if you have different opinions.

I'd like to say "let's just drop GCC C++11 support", but I guess that's not trivial to get through. Could you file a bug against GCC and ask for them to implement the Clang extension? Otherwise LGTM.

https://github.com/llvm/llvm-project/pull/121357


More information about the libcxx-commits mailing list