fork download
  1. #include <unordered_map>
  2.  
  3. class test;
  4. typedef std::unordered_map<int, test> test_map;
  5. typedef test_map::iterator test_map_iterator; // <== error
  6.  
  7. int main(){}
  8.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
In file included from /usr/include/c++/5/utility:70:0,
                 from /usr/include/c++/5/unordered_map:38,
                 from prog.cpp:1:
/usr/include/c++/5/bits/stl_pair.h: In instantiation of 'struct std::pair<const int, test>':
/usr/include/c++/5/ext/aligned_buffer.h:85:34:   required from 'struct __gnu_cxx::__aligned_buffer<std::pair<const int, test> >'
/usr/include/c++/5/bits/hashtable_policy.h:246:43:   required from 'struct std::__detail::_Hash_node_value_base<std::pair<const int, test> >'
/usr/include/c++/5/bits/hashtable_policy.h:292:12:   required from 'struct std::__detail::_Hash_node<std::pair<const int, test>, false>'
/usr/include/c++/5/bits/hashtable_policy.h:1896:60:   required from 'struct std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<const int, test>, false> > >'
/usr/include/c++/5/bits/hashtable.h:170:11:   required from 'class std::_Hashtable<int, std::pair<const int, test>, std::allocator<std::pair<const int, test> >, std::__detail::_Select1st, std::equal_to<int>, std::hash<int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >'
/usr/include/c++/5/bits/unordered_map.h:101:18:   required from 'class std::unordered_map<int, test>'
prog.cpp:5:17:   required from here
/usr/include/c++/5/bits/stl_pair.h:102:11: error: 'std::pair<_T1, _T2>::second' has incomplete type
       _T2 second;                /// @c second is a copy of the second object
           ^
prog.cpp:3:7: note: forward declaration of 'class test'
 class test;
       ^
stdout
Standard output is empty