2.95.2 failure of bitset operator[]

JDonner jdonner@schedsys.com
Fri Nov 5 13:33:00 GMT 1999


bitset operator[] fails in this:

#include <bitset>

int main()
{
  bitset<sizeof(int) * 8> bufWord;

  bufWord[3] = 0;
}


cd /home/jdonner/
gcc bittest.cpp -lstdc++
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-3/bitset:
In method `bitset<32,long unsigned
int>::reference::reference(bitset<32,long unsigned int> &, unsigned
int)':
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-3/bitset:753:  
instantiated from `bitset<32,long unsigned int>::operator [](unsigned
int)'
bittest.cpp:7:   instantiated from here
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-3/bitset:377:
`long unsigned int & _Base_bitset<1,long unsigned
int>::_M_getword(unsigned int)' is inaccessible
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-3/bitset:583:
within this context

Compilation exited abnormally with code 1 at Fri Nov  5 15:54:24


cd /home/jdonner/
gcc -v
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/specs
gcc version 2.95.2 19991024 (release)

Compilation finished at Fri Nov  5 15:56:15

......................

Incidentally, I have to link with -lstdc++ explicitly since messing up 
my installation (which has persisted through several complete
rebuilds).  
How can I restore gcc to linking with libstdc++ automatically?

Thanks,

Jeff
bitsetbug.tar.gz

-------------- next part --------------
A non-text attachment was scrubbed...
Name: bitsetbug.tar.gz
Type: application/x-gzip
Size: 28235 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-bugs/attachments/19991105/08c1739f/attachment.bin>


More information about the Gcc-bugs mailing list