Issue |
95207
|
Summary |
[clang++ arm64] std::move error
|
Labels |
clang
|
Assignees |
|
Reporter |
peter5232
|
My clang enironment is as below.
```
Target: arm64-apple-darwin23.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
```
And I write code for learning `std::move`.
```lang=cpp
#include <iostream>
#include <string>
#include <vector>
int main(){
std::string str = "Hello";
std::vector<std::string> v;
v.push_back(str);
std::cout << "After copy, str is \"" << str << "\"\n";
v.push_back(std::move(str));
std::cout << "After move, str is \"" << str << "\"\n";
std::cout << "The contents of the vector are \"" << v[0]
<< "\", \"" << v[1] << "\"\n";
}
```
The output is,
```
After copy, str is "Hello"
After move, str is "Hello"
The contents of the vector are "Hello", "Hello"
```
But `std::move` shoule move `str`. The right output is,
```
After copy, str is "Hello"
After move, str is ""
The contents of the vector are "Hello", "Hello"
```
I don't know why.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs