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.
Created attachment 16754 [details] preprocessed source from test case in bug report.
Confirmed.
This is essentially a defect in DR 778: http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#778 I'll see what we can do for now.
Subject: Bug 38244 Author: paolo Date: Mon Nov 24 11:13:44 2008 New Revision: 142152 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142152 Log: 2008-11-24 Paolo Carlini <paolo.carlini@oracle.com> PR libstdc++/38244 * include/std/bitset (bitset<>::bitset(const char*, char, char)): Remove, do not implement DR 778. * doc/xml/manual/intro.xml: Remove entry for DR 778. * testsuite/23_containers/bitset/cons/2.cc: Remove. * testsuite/23_containers/bitset/cons/dr396.cc: Tweak. * testsuite/23_containers/bitset/cons/38244.cc: Add. Added: trunk/libstdc++-v3/testsuite/23_containers/bitset/cons/38244.cc Removed: trunk/libstdc++-v3/testsuite/23_containers/bitset/cons/2.cc Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/doc/xml/manual/intro.xml trunk/libstdc++-v3/include/std/bitset trunk/libstdc++-v3/testsuite/23_containers/bitset/cons/dr396.cc
Fixed.
Subject: Bug 38244 Author: paolo Date: Mon Nov 24 11:19:39 2008 New Revision: 142153 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142153 Log: 2008-11-24 Paolo Carlini <paolo.carlini@oracle.com> PR libstdc++/38244 (cont, debug bits) * include/debug/bitset (bitset<>::bitset(const char*, char, char)): Remove, do not implement DR 778. Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/debug/bitset
Would it make sense to add a this test code as a test case?
(re: my last comment on 11/24: I see you added the test case in the original commit! Sorry, didn't notice that! Thanks much for resolving the issue.)