<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/147924>147924</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] "readability-container-data-pointer" - should not warn in non-const pointers usage before C++17
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
denzor200
</td>
</tr>
</table>
<pre>
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());
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy8VMGOqzgQ_BpzaRGZJiRw4JDMKNLe9wcauwHvGhvZJnmZr19BMvvyZg572idZQm6qW1XVBRSjGRxzK6qzqN4zWtLoQ6vZffiAUmad1_f2FOMyMfQ-QBpNBP5B02xZlCchT-Ign0eeYtJrsTzFFIwbgECU7yAQE8ckEAW-QfdZ42etPL92Tjyp-S6wFnggUZ2lqN7XNoGH7uVKu2g-eIM169mGvFIR8vTnyKBGVn_DzVgLc_B6UQy34N0AyuuHojeBZ4HnogBy-t_bfqO6JFA-BFbpF-hxgzq-cfh_PaCdpkSfKt-g-3L_7gKAwIvAC3AIfmUHipzzCYwzyZA1HwwEMwWaOHEA30O6zwwCj1dvNAg8CTzCzaQRyEG4kl34FaW8iwnUSOET-934P4B_zKtpW1oeK0geAk9k3FcnI5gEJq5yNsPX195qDr9u7THK69-buv82_AuXTLelbsqGMm6LY4VFWTdVmY1tw6hJHvpG9bovD2rfKSxqqftK0x6Ph8y0KLGSx0LKpqiqcierQ9UXdV1T3ZVU1GIvVwPtztrrtPNhyEyMC7fF_tjgPrPUsY3bh4yoLLkhT0bfV63VexbatSvvliGKvbQmpvhzTjLJbr-Al7ZqcyswaeqMNemeK-8SGcchXz3JZ29c4iAQIYc4-sVqWIN2o-DAOHDe5Y-wPJERlkgDQ8e9D_wzAtkSbDumNMd1F1t6B5PGpdspPwm8rDSfj3wO_i9WSeBl0x4FXp7yry3-EwAA__9i1mjS">