Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gcc/clang] Compilation issues #10

Open
Spirrwell opened this issue Oct 9, 2021 · 1 comment
Open

[gcc/clang] Compilation issues #10

Spirrwell opened this issue Oct 9, 2021 · 1 comment

Comments

@Spirrwell
Copy link

I can't compile the tests. I believe there are a few problems

using SlotSizeType = SizeType<IteratorValueType<I>>;

I don't think it's valid trying to get the size_type from the value_type of an iterator. This sounds like it might be tricky to solve.

There's also a few constexpr void functions (constexpr static void reset_version_counts()) and these only compile on C++14 or greater, but according to the README it sounds like this is supposed to target C++11.

There are a few instances where iterators are being taken by reference in these functions:

forward_empty_filled_dense_slots_basis
forward_empty_filled_dense_slots
versioned_forward_empty_filled_dense_slots

I'm not sure if this is necessary in any way, but it does not compile and gives error: cannot bind non-const lvalue reference errors.

I haven't figured out this last error yet, but I'm getting really weird linker errors surrounding regulated_slot_list::npos. This does NOT happen with C++17 or above, but I still don't understand it.

[build] /usr/bin/ld: CMakeFiles/test_slot_list.dir/examples/slot_list/rea_test_slot_list.cpp.o: warning: relocation against `_ZN3rea19regulated_slot_listI12instrumentedNS_9get_emptyIS1_EEmmSaIS1_EE4nposE' in read-only section `.text._ZNK3rea19regulated_slot_listI12instrumentedNS_9get_emptyIS1_EEmmSaIS1_EE7_get_idEm[_ZNK3rea19regulated_slot_listI12instrumentedNS_9get_emptyIS1_EEmmSaIS1_EE7_get_idEm]'
[build] /usr/bin/ld: CMakeFiles/test_slot_list.dir/examples/slot_list/rea_test_slot_list.cpp.o: in function `rea::regulated_slot_list<instrumented, rea::get_empty<instrumented>, unsigned long, unsigned long, std::allocator<instrumented> >::_get_id(unsigned long) const':
[build] /home/spirrwell/Documents/Git/Rea/include/rea.h:1346: undefined reference to `rea::regulated_slot_list<instrumented, rea::get_empty<instrumented>, unsigned long, unsigned long, std::allocator<instrumented> >::npos'
[build] /usr/bin/ld: warning: creating DT_TEXTREL in a PIE
@inobelar
Copy link

inobelar commented May 12, 2023

Similar issue I spotted, when call rea::slot_map<T>::clear().
For example:

rea::slot_map<int> s {};
s.clear();

g++ (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, --std=c++11 - compilation error:

In file included from ./main.cpp:99:
./example/third_party/Rea-master/Rea/rea.h: In instantiation of ‘void rea::slot_map<T, S, A>::_clear() [with T = int; S = long unsigned int; A = std::allocator<int>]’:
./example/third_party/Rea-master/Rea/rea.h:1647:3:   required from ‘void rea::slot_map<T, S, A>::clear() [with T = int; S = long unsigned int; A = std::allocator<int>]’
./main.cpp:103:13:   required from here
./example/third_party/Rea-master/Rea/rea.h:1536:54: error: no matching function for call to ‘forward_empty_filled_dense_slots(std::vector<long unsigned int, std::allocator<long unsigned int> >::iterator, std::vector<long unsigned int, std::allocator<long unsigned int> >::iterator, std::vector<rea::trivial_slot<long unsigned int>, std::allocator<rea::trivial_slot<long unsigned int> > >::iterator, long unsigned int&)’
 1536 |    empty_pos.first = forward_empty_filled_dense_slots(id_positions.begin(), id_positions.end(), id_slots.begin(), empty_pos.first);
      |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./example/third_party/Rea-master/Rea/rea.h:815:18: note: candidate: ‘template<class I1, class I2> rea::SlotSizeType<I> rea::forward_empty_filled_dense_slots(I1&, I1, I2&, rea::SlotSizeType<I>)’
  815 | SlotSizeType<I1> forward_empty_filled_dense_slots(I1 &first_position, I1 last_position, I2 &first_slot, SlotSizeType<I1> empty) {
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./example/third_party/Rea-master/Rea/rea.h:815:18: note:   template argument deduction/substitution failed:
In file included from ./main.cpp:99:
./example/third_party/Rea-master/Rea/rea.h: In substitution of ‘template<class T> using SizeType = typename T::size_type [with T = std::__iterator_traits<__gnu_cxx::__normal_iterator<long unsigned int*, std::vector<long unsigned int, std::allocator<long unsigned int> > >, void>::value_type]’:
./example/third_party/Rea-master/Rea/rea.h:69:7:   required by substitution of ‘template<class I> using SlotSizeType = rea::SizeType<typename std::iterator_traits<_Iter>::value_type> [with I = __gnu_cxx::__normal_iterator<long unsigned int*, std::vector<long unsigned int, std::allocator<long unsigned int> > >]’
./example/third_party/Rea-master/Rea/rea.h:815:18:   required by substitution of ‘template<class I1, class I2> rea::SlotSizeType<I> rea::forward_empty_filled_dense_slots(I1&, I1, I2&, rea::SlotSizeType<I>) [with I1 = __gnu_cxx::__normal_iterator<long unsigned int*, std::vector<long unsigned int, std::allocator<long unsigned int> > >; I2 = __gnu_cxx::__normal_iterator<rea::trivial_slot<long unsigned int>*, std::vector<rea::trivial_slot<long unsigned int>, std::allocator<rea::trivial_slot<long unsigned int> > > >]’
./example/third_party/Rea-master/Rea/rea.h:1536:54:   required from ‘void rea::slot_map<T, S, A>::_clear() [with T = int; S = long unsigned int; A = std::allocator<int>]’
./example/third_party/Rea-master/Rea/rea.h:1647:3:   required from ‘void rea::slot_map<T, S, A>::clear() [with T = int; S = long unsigned int; A = std::allocator<int>]’
./main.cpp:103:13:   required from here
./example/third_party/Rea-master/Rea/rea.h:39:7: error: ‘long unsigned int’ is not a class, struct, or union type
   39 | using SizeType = typename T::size_type;
      |       ^~~~~~~~

--> Compiler Explorer <--

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants