This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[libstdc++] Problems with hash_set (patch included)
- From: Peter Schmid <schmid at snake dot iap dot physik dot tu-darmstadt dot de>
- To: <libstdc++ at gcc dot gnu dot org>
- Cc: <gcc-patches at gcc dot gnu dot org>, <bkoz at redhat dot com>
- Date: Sun, 28 Apr 2002 17:42:56 +0200 (CEST)
- Subject: [libstdc++] Problems with hash_set (patch included)
Hashsets do no longer work on the branch. For example, the testcase
#include <ext/hash_set>
int main()
{
using namespace std;
using namespace __gnu_cxx;
const int werte[] = { 1, 25, 9, 16, -36};
const int anzahl = sizeof werte / sizeof(int);
hash_set<int> intTable(werte, werte + anzahl);
}
does not compile:
g++ -v -o tb1 tb1.C -W -Wall
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/specs
Configured with: ../gcc/configure --enable-shared --disable-nls --enable-threads=posix --enable-languages=c,c++,f77,objc
Thread model: posix
gcc version 3.1 20020427 (prerelease)
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/cc1plus -v -D__GNUC__=3 -D__GNUC_MINOR__=1 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -D__gnu_linux__ -Dlinux -D__ELF__ -D__unix__ -D__gnu_linux__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D_GNU_SOURCE -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i686__ -D__tune_pentiumpro__ tb1.C -D__GNUG__=3 -D__DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -quiet -dumpbase tb1.C -W -Wall -version -o /tmp/ccMyUWOa.s
GNU CPP version 3.1 20020427 (prerelease) (cpplib) (i386 Linux/ELF)
GNU C++ version 3.1 20020427 (prerelease) (i686-pc-linux-gnu)
compiled by GNU C version 3.1 20020427 (prerelease).
ignoring nonexistent directory "NONE/include"
ignoring nonexistent directory "/usr/local/i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include/g++-v3
/usr/local/include/g++-v3/i686-pc-linux-gnu
/usr/local/include/g++-v3/backward
/usr/local/include
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/include
/usr/include
End of search list.
/usr/local/include/g++-v3/ext/stl_hashtable.h: In member function `void
__gnu_cxx::hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey,
_Alloc>::insert_unique(_InputIterator, _InputIterator) [with _InputIterator
= const int*, _Val = int, _Key = int, _HashFcn = __gnu_cxx::hash<int>,
_ExtractKey = std::_Identity<int>, _EqualKey = std::equal_to<int>, _Alloc =
std::allocator<int>]':
/usr/local/include/g++-v3/ext/hash_set:137: instantiated from `__gnu_cxx::hash_set<_Value, _HashFcn, _EqualKey, _Alloc>::hash_set(_InputIterator, _InputIterator) [with _InputIterator = const int*, _Value = int, _HashFcn = __gnu_cxx::hash<int>, _EqualKey = std::equal_to<int>, _Alloc = std::allocator<int>]'
tb1.C:9: instantiated from here
/usr/local/include/g++-v3/ext/stl_hashtable.h:396: `__iterator_category'
undeclared (first use this function)
/usr/local/include/g++-v3/ext/stl_hashtable.h:396: (Each undeclared identifier
is reported only once for each function it appears in.)
The appended patch fixes this problem, a gcc 3.0 regression.
Hope this helps,
Peter Schmid
2002-04-28 Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de>
* include/ext/stl_hashtable.h: Import __iterator_category
*** include/ext/stl_hashtable.h.orig Sun Apr 28 16:32:39 2002
--- include/ext/stl_hashtable.h Sun Apr 28 16:33:19 2002
*************** using std::_Destroy;
*** 86,91 ****
--- 86,92 ----
using std::distance;
using std::vector;
using std::pair;
+ using std::__iterator_category;
template <class _Val>
struct _Hashtable_node