[Bug libstdc++/59712] New: unordered_map : clang fails with "member access into incomplete type"

2014-01-07 Thread oparcollet.triqs at gmail dot com
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 
int main() {
 std::unordered_map 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,
std::allocator >,
  std::__detail::_Select1st, std::equal_to, std::hash,
std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash,
  std::__detail::_Prime_rehash_policy,
std::__detail::_Hashtable_traits >'
 ._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,
std::allocator >,
  std::__detail::_Select1st, std::equal_to, std::hash,
std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash,
  std::__detail::_Prime_rehash_policy,
std::__detail::_Hashtable_traits >' requested here
  _Hashtable _M_h;
 ^
bug_hash_clang1y.cpp:3:30: note: in instantiation of template class
'std::unordered_map, std::equal_to,
  std::allocator > >' requested here
 std::unordered_map 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,
std::allocator >, std::__detail::_Select1st,
  std::equal_to, std::hash, std::__detail::_Mod_range_hashing,
std::__detail::_Default_ranged_hash,
  std::__detail::_Prime_rehash_policy,
std::__detail::_Hashtable_traits >' is not complete until
the closing '}'
class _Hashtable
  ^
1 error generated.


[Bug libstdc++/59712] unordered_map : clang fails with "member access into incomplete type"

2014-01-07 Thread oparcollet.triqs at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59712

--- Comment #2 from Olivier Parcollet  ---
I am not sure.

If I understood correctly, clang is stricter on this sort of issue than gcc,
but I do not know what the standard says.

A minimal version of such code is (from hashtable.h) : 

#include 

template class A {
 int f(int i) const noexcept { return i + 1; }
 static_assert(noexcept(std::declval().f(0)),"bla bla");
};

int main() {
 A a;
}

again gcc compiles it, not clang (same error as before).

Which one is right ?
(even though I don't really see the point of this static_assert in the first
place...).