title: GCC 4.1.1 doesn't compile some code with tr1::unordered_map
body: <p>I have following code to test one concept from a bigger program, and I try to compile with GCC 4.1.1 on Linux. I cannot use newer version of compiler due to corporate environment restrictions and so I have to make it compiling and working with currently available compiler version.</p>
  
  <pre><code>// test.cpp - my tr1::unordered_map usage example
  #include &lt;iostream&gt;
  #include &lt;tr1/unordered_map&gt;
  
  namespace YY {
  
  class X { public: X(int z_val = 0); private: int z; };
  inline X::X(int z_val) : z(z_val) {}
  
  enum XTE { Xt1, Xt2, Xt3 };
  
  }
  
  namespace std { namespace tr1 {
  
  #define _my_tr1_hashtable_define_trivial_hash(T)        \
    template&lt;&gt;                                            \
      struct hash&lt;T&gt;                                      \
      : public std::unary_function&lt;T, std::size_t&gt;        \
      {                                                   \
        std::size_t                                       \
        operator()(T val) const                           \
        { return static_cast&lt;std::size_t&gt;(val); }         \
      }                                                     
  
  _my_tr1_hashtable_define_trivial_hash(YY::XTE);
  
  #undef _my_tr1_hashtable_define_trivial_hash
  }}
  
  
  namespace YY {
  typedef std::tr1::unordered_map&lt;long long, X*&gt; TXM;
  typedef std::tr1::unordered_map&lt;XTE, TXM&gt; TTXM;
  }
  
  int main()
  {
      YY::TTXM m;
      std::cout &lt;&lt; m.size();
      return 0;
  }
  </code></pre>
  
  <p>Then I try to compile this code, gcc gives me following error:</p>
  
  <pre>
  $ g++ -c test.cpp
  /usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../include/c++/4.1.1/tr1/hashtable: In instantiation of Б─≤Internal::hash_code_base, Internal::extract1st >, std::equal_to, std::tr1::hash, Internal::mod_range_hashing, Internal::default_ranged_hash, false>Б─≥:
  /usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../include/c++/4.1.1/tr1/hashtable:1014:   instantiated from Б─≤std::tr1::hashtable, std::allocator >, Internal::extract1st >, std::equal_to, std::tr1::hash, Internal::mod_range_hashing, Internal::default_ranged_hash, Internal::prime_rehash_policy, false, false, true>Б─≥
  /usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../include/c++/4.1.1/tr1/unordered_map:63:   instantiated from Б─≤std::tr1::unordered_map, std::equal_to, std::allocator >, false>Б─≥
  /usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../include/c++/4.1.1/bits/stl_pair.h:74:   instantiated from Б─≤std::pair, std::equal_to, std::allocator >, false> >Б─≥
  /usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../include/c++/4.1.1/tr1/hashtable:413:   instantiated from Б─≤Internal::extract1st, std::equal_to, std::allocator >, false> > >Б─≥
  /usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../include/c++/4.1.1/tr1/hashtable:861:   instantiated from Б─≤Internal::hash_code_base, std::equal_to, std::allocator >, false> >, Internal::extract1st, std::equal_to, std::allocator >, false> > >, std::equal_to, std::tr1::hash, Internal::mod_range_hashing, Internal::default_ranged_hash, false>Б─≥
  /usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../include/c++/4.1.1/tr1/hashtable:1014:   instantiated from Б─≤std::tr1::hashtable, std::equal_to, std::allocator >, false> >, std::allocator, std::equal_to, std::allocator >, false> > >, Internal::extract1st, std::equal_to, std::allocator >, false> > >, std::equal_to, std::tr1::hash, Internal::mod_range_hashing, Internal::default_ranged_hash, Internal::prime_rehash_policy, false, false, true>Б─≥
  /usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../include/c++/4.1.1/tr1/unordered_map:63:   instantiated from Б─≤std::tr1::unordered_map, std::equal_to, std::allocator >, false>, std::tr1::hash, std::equal_to, std::allocator, std::equal_to, std::allocator >, false> > >, false>Б─≥
  test.cpp:42:   instantiated from here
  /usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../include/c++/4.1.1/tr1/hashtable:863: error: Б─≤Internal::hash_code_base::m_h1Б─≥ has incomplete type
  /usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../include/c++/4.1.1/tr1/functional:1101: error: declaration of Б─≤struct std::tr1::hashБ─≥
  </pre>
  
  <p>test.cpp:42:   instantiated from here
  is </p>
  
  <pre><code>YY::TTXM m;
  </code></pre>
  
  <p>If I change</p>
  
  <pre><code>typedef std::tr1::unordered_map&lt;XTE, TXM&gt; TTXM;
  </code></pre>
  
  <p>into</p>
  
  <pre><code>typedef std::tr1::unordered_map&lt;XTE, TXM*&gt; TTXM;
  </code></pre>
  
  <p>it compiles succesfully, but this is not what I want to do.
  Any ideas, suggestions, how to make this work? </p>