nagyistoce / sparsehash

Automatically exported from code.google.com/p/sparsehash
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

clang compile failure on FreeBSD #96

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. build package for freebsd ports

What is the expected output? What do you see instead?
build success

What version of the product are you using? On what operating system?
google-sparsehash-2.0.2
FreeBSD 11.0-CURRENT FreeBSD 11.0-CURRENT
FreeBSD 10.0-ALPHA

Please provide any additional information below.

Full build log here:
http://people.freebsd.org/~sbruno/google-sparsehash-2.0.2.log

Original issue reported on code.google.com by seanwbr...@gmail.com on 18 Oct 2013 at 4:15

GoogleCodeExporter commented 9 years ago
Seems to work fine with gcc, but clang is definitely not happy.  Since this 
uses tr1 things, does this code need a C11 refresh or something?

Original comment by DJFrankN...@gmail.com on 29 Oct 2013 at 9:36

GoogleCodeExporter commented 9 years ago
I'm getting compile error on FreeBSD 10 release with clang 3.3 too ( have you 
solved the problem yet? ) :
./src/sparsehash/internal/sparsehashtable.h:161:8: note: candidate constructor 
(the implicit copy constructor) not viable: requires 1
      argument, but 3 were provided
struct sparse_hashtable_iterator {
       ^
In file included from src/hashtable_test.cc:63:
./src/hash_test_interface.h:88:15: error: type 'typename 
sparse_hash_map<basic_string<char>, basic_string<char>, Hasher, Hasher,
      Alloc<basic_string<char>, unsigned long, 18446744073709551615> >::iterator' (aka 'sparse_hashtable_iterator<std::__1::pair<const
      std::__1::basic_string<char>, std::__1::basic_string<char> >, std::__1::basic_string<char>, <anonymous>::Hasher,
      google::sparse_hash_map<std::__1::basic_string<char>, std::__1::basic_string<char>, <anonymous>::Hasher, <anonymous>::Hasher,
      <anonymous>::Alloc<std::__1::basic_string<char>, unsigned long, 18446744073709551615> >::SelectKey,
      google::sparse_hash_map<std::__1::basic_string<char>, std::__1::basic_string<char>, <anonymous>::Hasher, <anonymous>::Hasher,
      <anonymous>::Alloc<std::__1::basic_string<char>, unsigned long, 18446744073709551615> >::SetKey, <anonymous>::Hasher,
      <anonymous>::Alloc<std::__1::basic_string<char>, unsigned long, 18446744073709551615> >') is not a direct or virtual base of
      'google::BaseHashtableInterface<google::sparse_hash_map<std::__1::basic_string<char>, std::__1::basic_string<char>,
      <anonymous>::Hasher, <anonymous>::Hasher, <anonymous>::Alloc<std::__1::basic_string<char>, unsigned long, 18446744073709551615> >
      >::iterator'
        : HT::iterator(it), parent_(parent) { }
              ^~~~~~~~
./src/hash_test_interface.h:144:12: note: in instantiation of member function
      'google::BaseHashtableInterface<google::sparse_hash_map<std::__1::basic_string<char>, std::__1::basic_string<char>,
      <anonymous>::Hasher, <anonymous>::Hasher, <anonymous>::Alloc<std::__1::basic_string<char>, unsigned long, 18446744073709551615> >
      >::iterator::iterator' requested here
    return iterator(ht_.begin(), this);
           ^
src/hashtable_test.cc:620:25: note: in instantiation of member function
      'google::BaseHashtableInterface<google::sparse_hash_map<std::__1::basic_string<char>, std::__1::basic_string<char>,
      <anonymous>::Hasher, <anonymous>::Hasher, <anonymous>::Alloc<std::__1::basic_string<char>, unsigned long, 18446744073709551615> >
      >::begin' requested here
  EXPECT_TRUE(this->ht_.begin() == this->ht_.end());
                        ^
./src/testutil.h:51:9: note: expanded from macro 'EXPECT_TRUE'
  if (!(cond)) {                                        \
        ^
src/hashtable_test.cc:619:1: note: in instantiation of member function 
'<anonymous
      namespace>::TEST_onetype_HashtableAllTest_NormalIterators<google::HashtableInterface_SparseHashMap<std::__1::basic_string<char>,
      std::__1::basic_string<char>, <anonymous>::Hasher, <anonymous>::Hasher, <anonymous>::Alloc<std::__1::basic_string<char>, unsigned
      long, 18446744073709551615> > >::Run' requested here
TYPED_TEST(HashtableAllTest, NormalIterators) {
^
./src/testutil.h:171:7: note: expanded from macro 'TYPED_TEST'
      Run();                                                            \
      ^
src/hashtable_test.cc:619:1: note: in instantiation of member function 
'<anonymous
      namespace>::TEST_onetype_HashtableAllTest_NormalIterators<google::HashtableInterface_SparseHashMap<std::__1::basic_string<char>,
      std::__1::basic_string<char>, <anonymous>::Hasher, <anonymous>::Hasher, <anonymous>::Alloc<std::__1::basic_string<char>, unsigned
      long, 18446744073709551615> > >::TEST_onetype_HashtableAllTest_NormalIterators' requested here
TYPED_TEST(HashtableAllTest, NormalIterators) {
^
./src/testutil.h:205:68: note: expanded from macro 'TYPED_TEST'
        TEST_onetype_##superclass##_##testname<superclass##_type7> t;   \
                                                                   ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
3 warnings and 20 errors generated.
*** Error code 1

Original comment by hmonfa...@gmail.com on 27 Aug 2014 at 10:16

GoogleCodeExporter commented 9 years ago
Seems clang is a bit more stringent - some of the allocators used in the test 
are wrong. Seems hashmap allocators need to return pairs. Separately looks like 
there's something wonky going on in libc++ or sparsehash itself - the first 
element of the pair needs to be const. Not sure why.

Either way - here's a patch to fix the compile with clang.

Original comment by mike.kap...@gmail.com on 27 Oct 2014 at 7:17

Attachments: