This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/69486] Strange behaviour of bitset and c++11


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69486

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|libstdc++                   |c++

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Trunk only uses 4GB not 5GB, but that's still far too much. Generating the
array initialization for this constexpr constructor is the problem:

      constexpr _Base_bitset(unsigned long long __val) noexcept
      : _M_w{ _WordT(__val)
       } { }


I think we have an existing bug report about this.

Reduced:

namespace std
{
  typedef decltype(sizeof(0)) size_t;

  template<size_t _Nw>
    struct _Base_bitset
    {
      typedef unsigned long _WordT;

      _WordT _M_w[_Nw];

      constexpr _Base_bitset() noexcept
      : _M_w() { }

      constexpr _Base_bitset(unsigned long long __val) noexcept
      : _M_w{ _WordT(__val)
       } { }
    };

  template<size_t _Nb>
    class bitset
    : private _Base_bitset<((_Nb) / (8 * 8) + ((_Nb) % (8 * 8) == 0 ? 0 : 1))>
    {
    public:
      constexpr bitset() noexcept
      { }
    };
}

std::bitset<2147483648> b;
int main() {}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]