[clang] [clang] Fix-it hint for `++this` -> `++*this` when deref is modifiable (PR #94159)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 10 11:31:23 PDT 2024
https://github.com/Sirraide commented:
The implementation looks fine, but a few more tests involving templates would be nice to see what this does with dependent types, e.g.
```c++
template <typename T>
void f(T& t) {
++t;
}
void g() {
int* a;
int* const b = a;
const int* const c = a;
f(a); // Ok.
f(b); // Error and fixit.
f(c); // Error, but no fixit.
}
```
I’d expect an error to be reported at instantiation time only; I doubt that there will be any complications here, but more tests are never a bad idea.
https://github.com/llvm/llvm-project/pull/94159
More information about the cfe-commits
mailing list