This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Inconsistent definition of vector<bool> specialization



hi -

I just ran into a header inconsistency with vector<bool> in
libstdc++-v3.  [I'm testing with gcc 2.95 on a gnu/linux system
with glibc 2.1.2 and binutils 2.9.1.0.23, but i don't think it matters
for this.]

There is a specialization for vector<bool> defined in ext/stl_bvector.h.
This file is _not_ included by #include <vector>.
(bits/std_vector.h has the commented-out line:

  //#include <bits/stl_bvector.h> // 990503 bkoz, non-standard
)

However, the file bits/std_queue.h (which is included by <queue>)
_does_ include ext/stl_bvector.h.

Thus, if someone includes just <vector> and uses vector<bool>,
he'll get the generic version.

But if he includes both <vector> and <queue> and uses vector<bool>,
he'll get the specialized version.

If those two modules are then linked together into the same program,
disaster can result.

Assuming that the decision to remove stl_bvector from std_vector.h was
correct, then one would have to remove it from std_queue.h too, to keep
things consistent.

Here's the patch.
sss

1999-11-23  scott snyder  <snyder@fnal.gov>

	* stl/bits/std_queue.h: Don't include stl_bvector.h, for
	consistency with std_vector.h.


Index: stl/bits/std_queue.h
===================================================================
RCS file: /cvs/libstdc++/libstdc++/stl/bits/std_queue.h,v
retrieving revision 1.2
diff -u -p -r1.2 std_queue.h
--- std_queue.h	1999/05/13 12:16:15	1.2
+++ std_queue.h	1999/11/23 18:56:13
@@ -32,7 +32,7 @@
 #include <bits/stl_construct.h>
 #include <bits/stl_uninitialized.h>
 #include <bits/stl_vector.h>
-#include <ext/stl_bvector.h>
+//#include <ext/stl_bvector.h>  // Not included by std_vector.h either.
 #include <bits/stl_heap.h>
 #include <bits/stl_deque.h>
 #include <bits/stl_function.h>

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]