This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug c++/26454] New: problem about GCC STL


I write a file, code as that:

#include <ext/hash_map>
#include <string>
using namespace std;
using namespace __gnu_cxx;

struct str_hash
{
        size_t operator()(const string& str) const
        {
                return __stl_hash_string(str.c_str());
        }
};
class A
{
public:
        hash_map<string,A,str_hash> map_body;
public:
        A();
};

int main()
{
        return 0;
}

=============================================

I find that can run in Visual Studio.2003,but my linux gcc 3.4.4 can not.

I know Microsoft with P.J.STL is not same as Gcc with SGI STL.

Report as :

Reading specs from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-java-awt=gtk --host=x86_64-redhat-linux
Thread model: posix
gcc version 3.4.4 20050721 (Red Hat 3.4.4-2)
 /usr/libexec/gcc/x86_64-redhat-linux/3.4.4/cc1plus -E -quiet -v -D_GNU_SOURCE
tt.cpp -mtune=k8 -o tt.ii
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../x86_64-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4

/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/x86_64-redhat-linux
 /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/backward
 /usr/local/include
 /usr/lib/gcc/x86_64-redhat-linux/3.4.4/include
 /usr/include
End of search list.
 /usr/libexec/gcc/x86_64-redhat-linux/3.4.4/cc1plus -fpreprocessed tt.ii -quiet
-dumpbase tt.cpp -mtune=k8 -auxbase tt -version -o tt.s
GNU C++ version 3.4.4 20050721 (Red Hat 3.4.4-2) (x86_64-redhat-linux)
        compiled by GNU C version 3.4.4 20050721 (Red Hat 3.4.4-2).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/stl_pair.h:
In instantiation of `std::pair<const std::string, A>':
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/stl_function.h:544:
  instantiated from `std::_Select1st<std::pair<const std::string, A> >'
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ext/hashtable.h:258:
  instantiated from `__gnu_cxx::hashtable<std::pair<const std::string, A>,
std::string, str_hash, std::_Select1st<std::pair<const std::string, A> >,
std::equal_to<std::string>, std::allocator<A> >'
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ext/hash_map:96:
  instantiated from `__gnu_cxx::hash_map<std::string, A, str_hash,
std::equal_to<std::string>, std::allocator<A> >'
tt.cpp:16:   instantiated from here
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/stl_pair.h:74:
error: `std::pair<_T1, _T2>::second' has incomplete type
tt.cpp:14: error: forward declaration of `class A'


===========================================

Please help me, thanks a lot!


-- 
           Summary: problem about GCC STL
           Product: gcc
           Version: 3.4.4
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: cnhome at vip dot sina dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26454


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