g++ compiled as of yesterday afternoon: Using built-in specs. Target: i686-linux Configured with: ../trunk/configure --enable-languages=c,c++ --build=i686-linux --host=i686-linux --target=i686-linux --prefix=/g/users/cgd/proj/gcc-trunk/bld/../inst Thread model: posix gcc version 4.4.0 20081123 (experimental) (GCC)
rejects the AFAICT-valid code: #include <bitset> class C0 { public: C0() : b(0) { } // FAILS. private: std::bitset<1> b; }; class C1 { public: C1() : b(1) { } // OK! private: std::bitset<1> b; }; void func() { C0 val0; C1 val1; } (in particular, the 'C0' initialization) with the error: test.cc: In constructor 'C0::C0()': test.cc:5: error: call of overloaded 'bitset(int)' is ambiguous /g/users/cgd/proj/gcc-trunk/inst/bin/../lib/gcc/i686-linux/4.4.0/../../../../include/c++/4.4.0/bitset:808: note: candidates are: std::bitset<_Nb>::bitset(const char*, char, char) [with unsigned int _Nb = 1u] /g/users/cgd/proj/gcc-trunk/inst/bin/../lib/gcc/i686-linux/4.4.0/../../../../include/c++/4.4.0/bitset:744: note: std::bitset<_Nb>::bitset(long unsigned int) [with unsigned int _Nb = 1u] /g/users/cgd/proj/gcc-trunk/inst/bin/../lib/gcc/i686-linux/4.4.0/../../../../include/c++/4.4.0/bitset:652: note: std::bitset<1u>::bitset(const std::bitset<1u>&) I'm not completely sure what's going on here, but I'm thinking it's related to the fact that the 'char*' ctor actually has two default arguments, and 0 is convertible to a pointer. This code is accepted by GCC 4.3.2 and the Comeau test drive. -- Summary: bitset initialization from 0 rejected. Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: cgd at google dot com GCC build triplet: i686-linux GCC host triplet: i686-linux GCC target triplet: i686-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38244