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

Compile error: "error: invalid initialization of reference of type ‘std::move_iterator<const long unsigned int*>::reference {aka long unsigned int&&}’ from expression of type ‘std::remove_reference<const long unsigned int&>::type {aka const long unsigned int}’" #227

Closed
bryanherger opened this issue Jul 5, 2021 · 3 comments · Fixed by #228

Comments

@bryanherger
Copy link
Contributor

I attempted to compile current master (as of 05 Jul 2021) on CentOS 7.9.2009 with CMake 3.17.5 and g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), but I get the following issue. Is a minimum g++ version required? v4.8.5 seems a bit dated relative to my OS release.

[ 66%] Building CXX object theta/test/CMakeFiles/theta_test.dir/theta_a_not_b_test.cpp.o
In file included from /usr/include/c++/4.8.2/bits/stl_algobase.h:67:0,
from /usr/include/c++/4.8.2/bits/char_traits.h:39,
from /usr/include/c++/4.8.2/string:40,
from /home/bryan/github/datasketches-cpp/common/test/catch.hpp:468,
from /home/bryan/github/datasketches-cpp/theta/test/theta_a_not_b_test.cpp:20:
/usr/include/c++/4.8.2/bits/stl_iterator.h: In instantiation of ‘std::move_iterator<_Iterator>::value_type&& std::move_iterator<_Iterator>::operator*() const [with _Iterator = const long unsigned int*; std::move_iterator<_Iterator>::reference = long unsigned int&&; std::move_iterator<_Iterator>::value_type = long unsigned int]’:
/usr/include/c++/4.8.2/bits/stl_algo.h:962:13: required from ‘_OIter std::copy_if(_IIter, _IIter, _OIter, _Predicate) [with _IIter = std::move_iterator<const long unsigned int*>; _OIter = std::back_insert_iterator<std::vector<long unsigned int, std::allocator > >; _Predicate = datasketches::key_less_than<long unsigned int, long unsigned int, datasketches::trivial_extract_key>]’
/home/bryan/github/datasketches-cpp/theta/include/theta_set_difference_base_impl.hpp:49:47: required from ‘CS datasketches::theta_set_difference_base<Entry, ExtractKey, CompactSketch, Allocator>::compute(FwdSketch&&, const Sketch&, bool) const [with FwdSketch = const datasketches::wrapped_compact_theta_sketch_alloc<std::allocator >; Sketch = datasketches::wrapped_compact_theta_sketch_alloc<std::allocator >; Entry = long unsigned int; ExtractKey = datasketches::trivial_extract_key; CompactSketch = datasketches::compact_theta_sketch_alloc<std::allocator >; Allocator = std::allocator]’
/home/bryan/github/datasketches-cpp/theta/include/theta_a_not_b_impl.hpp:37:63: required from ‘datasketches::theta_a_not_b_alloc::CompactSketch datasketches::theta_a_not_b_alloc::compute(FwdSketch&&, const Sketch&, bool) const [with FwdSketch = const datasketches::wrapped_compact_theta_sketch_alloc<std::allocator >; Sketch = datasketches::wrapped_compact_theta_sketch_alloc<std::allocator >; Allocator = std::allocator; datasketches::theta_a_not_b_alloc::CompactSketch = datasketches::compact_theta_sketch_alloc<std::allocator >]’
/home/bryan/github/datasketches-cpp/theta/test/theta_a_not_b_test.cpp:186:3: required from here
/usr/include/c++/4.8.2/bits/stl_iterator.h:963:37: error: invalid initialization of reference of type ‘std::move_iterator<const long unsigned int*>::reference {aka long unsigned int&&}’ from expression of type ‘std::remove_reference<const long unsigned int&>::type {aka const long unsigned int}’
{ return std::move(*_M_current); }
^
make[2]: *** [theta/test/CMakeFiles/theta_test.dir/theta_a_not_b_test.cpp.o] Error 1
make[1]: *** [theta/test/CMakeFiles/theta_test.dir/all] Error 2
make: *** [all] Error 2

@jmalkin
Copy link
Contributor

jmalkin commented Jul 5, 2021

Thanks for reporting this, I don't think anyone has tried it on 4.8.5 for a while. And I don't recall seeing it as an option in github actions, so we can't get it into our CI build. Operating on the idea that "untested == broken" I guess we should have expected this!

No ETA on this yet, but with luck we'll be able to look into it soon -- although there's a change the answer ends up being that we add a minimum gcc version.

@bryanherger
Copy link
Contributor Author

bryanherger commented Jul 6, 2021

I updated to devtools-7 with g++ (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5) but still get an error. This would suggest it's somewhere else in my build environment - most likely libc/glibc since it's in an allocator, but would like to check or upgrade the full stack if needed. Can you let me know what release/version of components are used for CI?

EDIT: I deployed an AWS instance with latest Amazon Linux 2.0, installed build tools cmake3, gcc-c++, and git, and compiled without issue. So it might be useful to know what the CI environment is also, but clearly it's a version issue on my side.

@AlexanderSaydakov
Copy link
Contributor

It seems to me that the problem has to do with a recently introduced wrapped_compact_theta_sketch. I would think that if you are not using this particular class in your code, it should continue to compile and work. If you would like to compile all unit tests, I would suggest commenting out the offending test in theta_a_not_b_test.cpp lines 170-190 for now.

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

Successfully merging a pull request may close this issue.

3 participants