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

Jeff Sparkes jsparkes@internetivity.com
Fri Nov 27 07:28:00 GMT 1998


> From: oliva@araguaia.dcc.unicamp.br
> On Nov 26, 1998, "Jeff Sparkes" <jsparkes@internetivity.com> wrote:
>
> > First of all, bitset is not included in the list of headers to install
> > in Makefile.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
bitset
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.

bitset.cc:
#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
int)':
/usr/local/egcs/include/g++-2/bitset:751:   instantiated from
`bitset<128,long unsigned int>::operator [](unsigned int)'
bitset.cc:9:   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