Hi, > On 11/05/2010 09:03 PM, Gabriel Dos Reis wrote: >> I'm looking into std::bitset with respect to constexpr issue. >> My understanding has always been that one can use the >> syntax `member()' to value-initialize an array data member >> `member'. > I believe so. Thanks Gaby and Jason.
I wanted to apply the below patch, which seems correct to me in the light of your exchange and triggered ICEs, for 23_containers/bitset/cons/constexpr.cc for example I got: In file included from /home/paolo/Gcc/svn-dirs/trunk/libstdc++-v3/testsuite/23_containers/bitset/cons/constexpr.cc:21:0: /home/paolo/Gcc/svn-dirs/trunk-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/bitset: In constructor 'constexpr std::_Base_bitset<_Nw>::_Base_bitset() [with long unsigned int _Nw = 4ul]': /home/paolo/Gcc/svn-dirs/trunk-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/bitset:814:7: instantiated from 'constexpr std::bitset<_Nb>::bitset() [with long unsigned int _Nb = 256ul]' /home/paolo/Gcc/svn-dirs/trunk/libstdc++-v3/testsuite/util/testsuite_common_types.h:627:20: instantiated from 'void __gnu_test::constexpr_default_constructible::operator()()::_Concept::__constraint() [with _Tp = std::bitset<256ul>]' /home/paolo/Gcc/svn-dirs/trunk/libstdc++-v3/testsuite/util/testsuite_common_types.h:631:17: instantiated from 'void __gnu_test::constexpr_default_constructible::operator()() [with _Tp = std::bitset<256ul>]' /home/paolo/Gcc/svn-dirs/trunk/libstdc++-v3/testsuite/23_containers/bitset/cons/constexpr.cc:29:38: instantiated from here /home/paolo/Gcc/svn-dirs/trunk-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/bitset:76:18: internal compiler error: in build_data_member_initialization, at cp/semantics.c:5499 Can you have a look? Thanks, Paolo. //////////////////////
Index: include/std/bitset =================================================================== --- include/std/bitset (revision 166384) +++ include/std/bitset (working copy) @@ -72,9 +72,10 @@ /// 0 is the least significant word. _WordT _M_w[_Nw]; -#ifdef __GXX_EXPERIMENTAL_CXX0X__ - constexpr _Base_bitset() : _M_w({ }) { } + _GLIBCXX_CONSTEXPR _Base_bitset() + : _M_w() { } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ constexpr _Base_bitset(unsigned long long __val) : _M_w({ _WordT(__val) #if __SIZEOF_LONG_LONG__ > __SIZEOF_LONG__ @@ -82,14 +83,9 @@ #endif }) { } #else - _Base_bitset() - { _M_do_reset(); } - _Base_bitset(unsigned long __val) - { - _M_do_reset(); - _M_w[0] = __val; - } + : _M_w() + { _M_w[0] = __val; } #endif static _GLIBCXX_CONSTEXPR size_t