This is the mail archive of the libstdc++@gcc.gnu.org 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]
Other format: [Raw text]

[Patch] libstdc++/21244


Hi,

due to the delicate c++ issue clarified in c++/19404 by Mark we have got
this new library PR (in 4.0 and mainline) because our vector<bool> uses
indeed a namespace scope *anonymous* enum. In order to fix it I propose
the minimal change of giving a name to the enum. Is this 100% safe from
the ABI/interoperability point of view?? I think so, but want to double
check with you before going ahead.

Tested x86-linux.

Paolo.

//////////////////
2005-04-27  Dominik Strasser  <dominik.strasser@infineon.com>
	    Paolo Carlini  <pcarlini@suse.de>

	PR libstdc++/21244
	* include/bits/stl_bvector.h: Change the anonymous enum
	at namespace scope to _S_word_bit_enum.
	* testsuite/23_containers/vector/bool/21244.cc: New.
Index: include/bits/stl_bvector.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/stl_bvector.h,v
retrieving revision 1.39
diff -u -r1.39 stl_bvector.h
--- include/bits/stl_bvector.h	31 Jan 2005 16:21:55 -0000	1.39
+++ include/bits/stl_bvector.h	27 Apr 2005 09:54:07 -0000
@@ -64,7 +64,7 @@
 namespace _GLIBCXX_STD
 {
   typedef unsigned long _Bit_type;
-  enum { _S_word_bit = int(CHAR_BIT * sizeof(_Bit_type)) };
+  enum _S_word_bit_enum { _S_word_bit = int(CHAR_BIT * sizeof(_Bit_type)) };
 
   struct _Bit_reference
   {
Index: testsuite/23_containers/vector/bool/21244.cc
===================================================================
RCS file: testsuite/23_containers/vector/bool/21244.cc
diff -N testsuite/23_containers/vector/bool/21244.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testsuite/23_containers/vector/bool/21244.cc	27 Apr 2005 09:54:08 -0000
@@ -0,0 +1,36 @@
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+ 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+ 
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+#include <vector>
+
+// { dg-do compile }
+
+class Foo
+{
+};
+
+template<class T> Foo operator/(const Foo& arg1, T arg2)
+{
+  return Foo();
+}
+
+// libstdc++/21244
+void foo()
+{
+  std::vector<bool> bar(1);
+}

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