We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4dbf126 commit 4b82eddCopy full SHA for 4b82edd
1 file changed
tests/unit/redundant_copy_in_conversion.cpp
@@ -5,5 +5,13 @@ int main() {
5
m[0] = 1;
6
std::map<int, int>::iterator end = m.end();
7
std::map<int, int>::const_iterator const_it = m.find(0);
8
+ // Comparing const_iterator with iterator forces an implicit conversion of
9
+ // `end` to const_iterator. The AST shape differs between platforms:
10
+ //
11
+ // Linux: const_it == ConvertingCtor(end)
12
+ // macOS: const_it == ConvertingCtor(CopyCtor(end))
13
14
+ // The extra inner CopyCtor on macOS would emit a redundant .clone() in the
15
+ // generated Rust. cpp2rust suppresses it so the output matches Linux.
16
return const_it == end ? 0 : 1;
17
}
0 commit comments