public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/38244]  New: bitset initialization from 0 rejected.
@ 2008-11-24  3:54 cgd at google dot com
  2008-11-24  3:55 ` [Bug libstdc++/38244] " cgd at google dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: cgd at google dot com @ 2008-11-24  3:54 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-12-01 18:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-24  3:54 [Bug libstdc++/38244] New: bitset initialization from 0 rejected cgd at google dot com
2008-11-24  3:55 ` [Bug libstdc++/38244] " cgd at google dot com
2008-11-24 10:09 ` rguenth at gcc dot gnu dot org
2008-11-24 10:22 ` paolo dot carlini at oracle dot com
2008-11-24 10:52 ` [Bug libstdc++/38244] [4.4 Regression] " paolo dot carlini at oracle dot com
2008-11-24 11:16 ` paolo at gcc dot gnu dot org
2008-11-24 11:16 ` paolo dot carlini at oracle dot com
2008-11-24 11:22 ` paolo at gcc dot gnu dot org
2008-11-24 20:56 ` cgd at google dot com
2008-12-01 18:32 ` cgd at google dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).