This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
libstdc++: 2.95.2 failure of bitset operator[]
- To: jdonner at schedsys dot com
- Subject: libstdc++: 2.95.2 failure of bitset operator[]
- From: "Martin v. Loewis" <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Date: Sat, 6 Nov 1999 10:00:53 +0100
- CC: gcc-bugs at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- References: <38234C41.22C073F@schedsys.com>
> bitset operator[] fails in this:
Thanks for your bug report. Here is a patch.
Ok to install? In the release branch, too?
Martin
1999-11-06 Martin v. Löwis <loewis@informatik.hu-berlin.de>
* bitset: Include limits.h.
* bitset (class bitset): Declare reference as our friend.
// Origin: Jeff Donner <jdonner@schedsys.com>
#include <bitset>
int main()
{
bitset<sizeof(int) * 8> bufWord;
bufWord[3] = 0;
}
Index: bitset
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++/stl/bitset,v
retrieving revision 1.4
diff -u -r1.4 bitset
--- bitset 1999/04/11 22:53:05 1.4
+++ bitset 1999/11/06 08:50:43
@@ -36,6 +36,7 @@
#include <stddef.h> // for size_t
+#include <limits.h> // for CHAR_BIT
#include <string>
#include <stdexcept> // for invalid_argument, out_of_range, overflow_error
#include <iostream.h> // for istream, ostream
@@ -568,6 +569,8 @@
public:
// bit reference:
+ class reference;
+ friend class reference;
class reference {
friend class bitset;
Index: stl_config.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++/stl/stl_config.h,v
retrieving revision 1.15
diff -u -r1.15 stl_config.h
--- stl_config.h 1999/05/17 23:03:48 1.15
+++ stl_config.h 1999/11/06 08:50:48
@@ -161,7 +161,6 @@
# define __STL_MEMBER_TEMPLATE_CLASSES
# define __STL_EXPLICIT_FUNCTION_TMPL_ARGS
# define __STL_HAS_NAMESPACES
-# define __STL_NO_NAMESPACES
# define __SGI_STL_USE_AUTO_PTR_CONVERSIONS
# define __STL_USE_NAMESPACES
# endif