Closed
Bug 1869256
Opened 1 year ago
Closed 1 year ago
Compile error calling std::swap on SegmentedVectors
Categories
(Core :: MFBT, defect)
Core
MFBT
Tracking
()
RESOLVED
FIXED
122 Branch
Tracking | Status | |
---|---|---|
firefox122 | --- | fixed |
People
(Reporter: jonco, Assigned: jonco)
References
Details
(Whiteboard: [sp3])
Attachments
(1 file)
I'd like to swap two segmented vectors but this doesn't compile:
/home/jon/clone/semi/mfbt/tests/TestSegmentedVector.cpp:140:3: error: no matching function for call to 'swap'
140 | std::swap(v, w);
| ^~~~~~~~~
/home/jon/.mozbuild/sysroot-x86_64-linux-gnu/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/move.h:182:5: note: candidate template ignored: requirement '__and_<std::__not_<std::__is_tuple_like<mozilla::SegmentedVector<int, 32, InfallibleAllocPolicy>>>, std::is_move_constructible<mozilla::SegmentedVector<int, 32, InfallibleAllocPolicy>>, std::is_move_assignable<mozilla::SegmentedVector<int, 32, InfallibleAllocPolicy>>>::value' was not satisfied [with _Tp = MyVector]
182 | swap(_Tp& __a, _Tp& __b)
| ^
/home/jon/.mozbuild/sysroot-x86_64-linux-gnu/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/move.h:205:5: note: candidate template ignored: could not match '_Tp[_Nm]' against 'MyVector' (aka 'SegmentedVector<int, 32, InfallibleAllocPolicy>')
205 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
| ^
/home/jon/.mozbuild/sysroot-x86_64-linux-gnu/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_pair.h:495:5: note: candidate template ignored: could not match 'pair' against 'SegmentedVector'
495 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
| ^
/home/jon/.mozbuild/sysroot-x86_64-linux-gnu/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_pair.h:503:5: note: candidate template ignored: could not match 'pair' against 'SegmentedVector'
503 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete;
| ^
/home/jon/.mozbuild/sysroot-x86_64-linux-gnu/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/basic_string.h:6285:5: note: candidate template ignored: could not match 'basic_string' against 'SegmentedVector'
6285 | swap(basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^
/home/jon/.mozbuild/sysroot-x86_64-linux-gnu/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/array:294:5: note: candidate template ignored: could not match 'array' against 'SegmentedVector'
294 | swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two)
| ^
/home/jon/.mozbuild/sysroot-x86_64-linux-gnu/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/array:302:5: note: candidate template ignored: could not match 'array' against 'SegmentedVector'
302 | swap(array<_Tp, _Nm>&, array<_Tp, _Nm>&) = delete;
| ^
/home/jon/.mozbuild/sysroot-x86_64-linux-gnu/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/tuple:1618:5: note: candidate template ignored: could not match 'tuple' against 'SegmentedVector'
1618 | swap(tuple<_Elements...>& __x, tuple<_Elements...>& __y)
| ^
/home/jon/.mozbuild/sysroot-x86_64-linux-gnu/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/tuple:1625:5: note: candidate template ignored: could not match 'tuple' against 'SegmentedVector'
1625 | swap(tuple<_Elements...>&, tuple<_Elements...>&) = delete;
| ^
/home/jon/clone/semi/optdebug-build/dist/include/mozilla/CompactPair.h:238:6: note: candidate template ignored: could not match 'CompactPair' against 'SegmentedVector'
238 | void swap(mozilla::CompactPair<A, B>& aX, mozilla::CompactPair<A, B>& aY) {
| ^
/home/jon/clone/semi/optdebug-build/dist/include/mozilla/UniquePtr.h:642:6: note: candidate template ignored: could not match 'UniquePtr' against 'SegmentedVector'
642 | void swap(mozilla::UniquePtr<T, D>& aX, mozilla::UniquePtr<T, D>& aY) {
| ^
/home/jon/.mozbuild/sysroot-x86_64-linux-gnu/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/sstream:797:5: note: candidate template ignored: could not match 'basic_stringbuf' against 'SegmentedVector'
797 | swap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x,
| ^
/home/jon/.mozbuild/sysroot-x86_64-linux-gnu/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/sstream:804:5: note: candidate template ignored: could not match 'basic_istringstream' against 'SegmentedVector'
804 | swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x,
| ^
/home/jon/.mozbuild/sysroot-x86_64-linux-gnu/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/sstream:811:5: note: candidate template ignored: could not match 'basic_ostringstream' against 'SegmentedVector'
811 | swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x,
| ^
/home/jon/.mozbuild/sysroot-x86_64-linux-gnu/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/sstream:818:5: note: candidate template ignored: could not match 'basic_stringstream' against 'SegmentedVector'
818 | swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x,
| ^
1 error generated.
Assignee | ||
Updated•1 year ago
|
Summary: Compile error calling std::swap on SegmenetedVectors → Compile error calling std::swap on SegmentedVectors
Assignee | ||
Comment 1•1 year ago
|
||
The patch implements the move assigment operator in terms of the move
constructor. This fulfills the requirements for std::swap to compile.
Pushed by jcoppeard@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d404928e57cf
Add move assignment operator for SegmentedVector r=mccr8
Comment 3•1 year ago
•
|
||
Backed out for causing bustages on TestSegmentedVector.cpp
Flags: needinfo?(jcoppeard)
Comment 4•1 year ago
|
||
Weird. I didn't know that was a thing we warned against.
Pushed by jcoppeard@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/cb63408380d2
Add move assignment operator for SegmentedVector r=mccr8
Comment 7•1 year ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 1 year ago
status-firefox122:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → 122 Branch
Updated•11 months ago
|
Whiteboard: [sp3]
Updated•11 months ago
|
See Also: → https://mozilla-hub.atlassian.net/browse/SP3-737
You need to log in
before you can comment on or make changes to this bug.
Description
•