<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/55026>55026</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-tidy check readability-container-data-pointer fix isn't configurable to use std::string::c_str() instead of data()
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
sean-mcmanus
</td>
</tr>
</table>
<pre>
This is an "enhancement" request. I used clang-tidy 14.0.0.
Use code
```
#include <string>
int main()
{
std::string st1;
char *cp1 = &st1[0];
return 0;
}
```
The clang-tidy fix creates `st1.data()` -- ideally the fix would create `std.c_str()` instead or have a fix configuration option for that.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxtUk2TmzAM_TVw8cAYAwk5cNhtujO9b88dYQtw69ipLXabf18F0ibtLHhsyfp4T7KGYC7962yT4AVeZEqhn8FrPKEn1kTEnwsmKsUXsSQ0QjvwU0HWXETVlJL_TB4z-bTtXxMKHQze7nbytjZV1dZrtxgUWf0pUbR-yurPj_HWkziB9ZnqMnW4WfbPmyD4S2Sy-onXFs56ldUPdj1D5Cqe9LlikCOLu6tL-yyz9viPZ0Raohfy72W2P35Me91fZ3ysfbS_hI4IhEmwJ2OUBghuvHdSFIWwBsG5iyAOvfq_h8WZW9QWZEr9jQu5R1mfCMGIEMUMbyhgAwp-tNMSgWzwIpzXY2QfmoFu_c9NX5tDfYCcLDnsH7jqGfUPrhcMDNZZuhSckLjLGIsr6eIcuO8YVyybuPl7umMODgWF6-P_3_xNfqjgTn8U927kS3T9THRO1wD1wmuyNC9DqcOJFefe_hzFOYbvqHnwXmxKPHcstK1Uu3zuuwZQHbqmQwmj7jqtVLtXraoOQ9MZhnEwoEs9vzXPrcd3saZgmV8-t72SSslGVaqqZdOWagTs6qrmRM0BsMkaiTx5rrzyKEOc8tivlIZlSmx0NlG6GyElO3nEFY7zw0JziH1C8MVJn8AvKV_x-5X_b7tCCdU">