<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/61624>61624</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            readability-make-member-function-const could detect more cases where a pointer member is read but not dereferenced
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-tidy
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          sfc-gh-sgiesecke
      </td>
    </tr>
</table>

<pre>
    readability-make-member-function-const doesn't suggest declaring member functions `const` which could be `const`, where a pointer member is read but not dereferenced, such as any of the following:
```
#include <memory>

struct foo {

    bool hasPlain() {
        return m_plain_ptr != nullptr;
    }

 bool hasPlainImplicitCast() {
        return m_plain_ptr;
    }

 bool hasPlainExplicitCast() {
        return static_cast<bool>(m_plain_ptr);
    }

    bool hasUnique() {
 return m_unique_ptr != nullptr;
    }

    bool hasUniqueGet() {
        return m_unique_ptr.get() != nullptr;
    }

    bool hasUniqueExplicitCast() {
        return static_cast<bool>(m_unique_ptr);
    }

private:
  int* m_plain_ptr;
  std::unique_ptr<int> m_unique_ptr;
};
```

See also https://godbolt.org/z/W8Mr6TPKq

I think the argument 
> Specifically, this check will not suggest to add a const to a non-const method if the method reads a private member variable of pointer type because that allows to modify the pointee which might not preserve logical constness.

doesn't apply if the pointer is never dereferenced.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVU1v4zYQ_TX0ZWBDIm3HOuiQTeJiURRYYFv0GFDkSGJDkVpy6NT99QUlf2UX7aYfhiGb5rx5M8_kGxmj6RxizTYf2OZxIRP1PtSxVcuuX8bOYET1govG62MdUGrZGGvouBzkCy4HHBoMyzY5Rca7pfIuEmiP0TF-RxBT12H-BZWVwbgOZgScERHYtphQbFvAa29UD8onq6HB2y3GH-C1x4AgYfTGEYZzKhMh1wVNInA-cwVsMaBTqDMsJtWDjCDdEXwL1CO03lr_al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