Issue |
147924
|
Summary |
[clang-tidy] "readability-container-data-pointer" - should not warn in non-const pointers usage before C++17
|
Labels |
clang-tidy
|
Assignees |
|
Reporter |
denzor200
|
Assume for this example:
```
std::string a = "test", b = "eest";
std::memcpy(&a[0], &b[0], a.size());
```
The check will produce wrong code for C++11 and C++14, but correct for C++17 and newer:
```
std::string a = "test", b = "eest";
std::memcpy(a.data(), b.data(), a.size()); // error: cannot initialize a parameter of type 'void *' with an rvalue of type 'const char *'
```
I expect this check to remain for C++17 as it is, but for older will produce this code:
```
std::string a = "test", b = "eest";
std::memcpy(&a[0], b.data(), a.size());
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs