problems with libstdc++/stl/bitset in 1122 snapshot

Jeff Sparkes
Fri Nov 27 07:28:00 GMT 1998

> From:
> On Nov 26, 1998, "Jeff Sparkes" <> wrote:
> > First of all, bitset is not included in the list of headers to install
> > in
> > Once it is installed, I get error from one of the constructors.
> Here's a patch.  Ok to install?

Thanks, that gets me past the first hurdle.

A question about the patch: shouldn't the STL version compile without error?
In other words, is your patch just a workaround for a egcs bug?

I also found that bitset required min() from stl_algobase.h.  Shouldn't the
header include everything it needs?  I'm not sure of the policy about that.

Given the test program below, it still doesn't compile.  The complaints have
something to do with the nested class reference.
#include <cstdio>
#include <stl_algobase.h>       // Shouldn't need to do this!
#include <bitset>

main(int argc, char *argv)
        bitset<128> b(33);
        for (int i=127; i>=0 ; i--) {
                if (b[i])
                        printf("%d\n", i);

The error messages:
usr/local/egcs/include/g++-2/bitset: In method `bitset<128,long unsigned
int>::reference::reference(class bitset<128,long unsigned int> &, unsigned
/usr/local/egcs/include/g++-2/bitset:751:   instantiated from
`bitset<128,long unsigned int>::operator [](unsigned int)'   instantiated from here
/usr/local/egcs/include/g++-2/bitset:91: `long unsigned int &
_Base_bitset<4,long unsigned int>::_M_getword(unsigned int)' is from private
base class
/usr/local/egcs/include/g++-2/bitset:581: within this context

More information about the Gcc-bugs mailing list