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 libstdc++/59712] New: unordered_map : clang fails with "member access into incomplete type"


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

            Bug ID: 59712
           Summary: unordered_map : clang fails with "member access into
                    incomplete type"
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: oparcollet.triqs at gmail dot com

The code : 

#include <unordered_map>
int main() {
 std::unordered_map<int,int> M;
}

using : 
- libstdc++ of gcc 4.9.0, svn r206386. 
- clang3.4, -std=c++11 mode
- Ubuntu 12.04

fails with clang (while it compiles with gcc 4.9.0) due to 
a member access into one incomplete type in a template...

If one comments this static_assert in the hashtable.h:267, clang compiles the
code correctly.

Error : 

LAB:~/C++ $ ~/CLANG/install/bin/clang++ -std=c++11 bug_hash_clang1y.cpp 
In file included from bug_hash_clang1y.cpp:1:
In file included from
/home/..../gcc4.9/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0/unordered_map:47:
/home/.../gcc4.9/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0/bits/hashtable.h:267:9:
error: member access into
      incomplete type 'const std::_Hashtable<int, std::pair<const int, int>,
std::allocator<std::pair<const int, int> >,
      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> >'
                             ._M_bucket_index((const __node_type*)nullptr,
                             ^
/home/.../gcc4.9/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0/bits/unordered_map.h:101:18:
note: in instantiation
      of template class 'std::_Hashtable<int, std::pair<const int, int>,
std::allocator<std::pair<const int, int> >,
      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> >' requested here
      _Hashtable _M_h;
                 ^
bug_hash_clang1y.cpp:3:30: note: in instantiation of template class
'std::unordered_map<int, int, std::hash<int>, std::equal_to<int>,
      std::allocator<std::pair<const int, int> > >' requested here
 std::unordered_map<int,int> M;
                             ^
/home/..../gcc4.9/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0/bits/hashtable.h:174:11:
note: definition of
      'std::_Hashtable<int, std::pair<const int, int>,
std::allocator<std::pair<const int, int> >, 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> >' is not complete until
the closing '}'
    class _Hashtable
          ^
1 error generated.


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