Actions
Bug #22139
closedclang compilation error in BoundedKeyCounter
Status:
Resolved
Priority:
Normal
Assignee:
-
Target version:
-
% Done:
0%
Source:
Tags:
Backport:
luminous
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):
Description
clang complains about the use of BoundedKeyCounter::const_pointer_iterator in vector::assign(), because it doesn't satisfy the ForwardIterator concept:
In file included from /home/jenkins/workspace/ceph-master/src/test/common/test_bounded_key_counter.cc:14: /home/jenkins/workspace/ceph-master/src/common/bounded_key_counter.h:154:14: error: no matching member function for call to 'assign' sorted.assign(const_pointer_iterator{counters.cbegin()}, ~~~~~~~^~~~~~ /home/jenkins/workspace/ceph-master/src/test/common/test_bounded_key_counter.cc:24:11: note: in instantiation of function template specialization 'BoundedKeyCounter<int, int>::get_highest<(lambda at /home/jenkins/workspace/ceph-master/src/test/common/test_bounded_key_counter.cc:24:30)>' requested here counter.get_highest(count, [&callbacks] (const Key& key, Count count) { ^ /home/jenkins/workspace/ceph-master/src/test/common/test_bounded_key_counter.cc:66:17: note: in instantiation of function template specialization '(anonymous namespace)::count_highest<int, int>' requested here EXPECT_EQ(0u, count_highest(counter, 10)); ^ /usr/include/c++/v1/vector:588:10: note: candidate function not viable: no known conversion from 'BoundedKeyCounter<int, int>::const_pointer_iterator' to 'std::__1::vector<const std::__1::pair<const int, int> *, std::__1::allocator<const std::__1::pair<const int, int> *> >::size_type' (aka 'unsigned long') for 1st argument void assign(size_type __n, const_reference __u); ^ /usr/include/c++/v1/vector:576:9: note: candidate template ignored: requirement '!__is_forward_iterator<const_pointer_iterator>::value' was not satisfied [with _InputIterator = BoundedKeyCounter<int, int>::const_pointer_iterator] assign(_InputIterator __first, _InputIterator __last); ^ /usr/include/c++/v1/vector:586:9: note: candidate template ignored: requirement 'is_constructible<value_type, typename iterator_traits<const_pointer_iterator>::reference>::value' was not satisfied [with _ForwardIterator = BoundedKeyCounter<int, int>::const_pointer_iterator] assign(_ForwardIterator __first, _ForwardIterator __last); ^ /usr/include/c++/v1/vector:592:10: note: candidate function not viable: requires single argument '__il', but 2 arguments were provided void assign(initializer_list<value_type> __il) ^ In file included from /home/jenkins/workspace/ceph-master/src/test/common/test_bounded_key_counter.cc:14: /home/jenkins/workspace/ceph-master/src/common/bounded_key_counter.h:154:14: error: no matching member function for call to 'assign' sorted.assign(const_pointer_iterator{counters.cbegin()}, ~~~~~~~^~~~~~ /home/jenkins/workspace/ceph-master/src/test/common/test_bounded_key_counter.cc:36:11: note: in instantiation of function template specialization 'BoundedKeyCounter<int, int>::get_highest<(lambda at /home/jenkins/workspace/ceph-master/src/test/common/test_bounded_key_counter.cc:36:30)>' requested here counter.get_highest(count, [&results] (const Key& key, Count count) { ^ /home/jenkins/workspace/ceph-master/src/test/common/test_bounded_key_counter.cc:111:30: note: in instantiation of function template specialization '(anonymous namespace)::get_highest<int, int, std::__1::vector<std::__1::pair<int, int>, std::__1::allocator<std::__1::pair<int, int> > > >' requested here EXPECT_EQ(Vector({{1,1}}), get_highest(counter, 10)); ^ /usr/include/c++/v1/vector:588:10: note: candidate function not viable: no known conversion from 'BoundedKeyCounter<int, int>::const_pointer_iterator' to 'std::__1::vector<const std::__1::pair<const int, int> *, std::__1::allocator<const std::__1::pair<const int, int> *> >::size_type' (aka 'unsigned long') for 1st argument void assign(size_type __n, const_reference __u); ^ /usr/include/c++/v1/vector:576:9: note: candidate template ignored: requirement '!__is_forward_iterator<const_pointer_iterator>::value' was not satisfied [with _InputIterator = BoundedKeyCounter<int, int>::const_pointer_iterator] assign(_InputIterator __first, _InputIterator __last); ^ /usr/include/c++/v1/vector:586:9: note: candidate template ignored: requirement 'is_constructible<value_type, typename iterator_traits<const_pointer_iterator>::reference>::value' was not satisfied [with _ForwardIterator = BoundedKeyCounter<int, int>::const_pointer_iterator] assign(_ForwardIterator __first, _ForwardIterator __last); ^ /usr/include/c++/v1/vector:592:10: note: candidate function not viable: requires single argument '__il', but 2 arguments were provided void assign(initializer_list<value_type> __il) ^ 2 errors generated. gmake[2]: *** [src/test/common/CMakeFiles/unittest_bounded_key_counter.dir/build.make:63: src/test/common/CMakeFiles/unittest_bounded_key_counter.dir/test_bounded_key_counter.cc.o] Error 1
Actions