[PATCH] D124966: Thread safety analysis: Handle compound assignment and ->* overloads

Aaron Puchert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 4 14:58:27 PDT 2022


aaronpuchert added a subscriber: rupprecht.
aaronpuchert added a comment.

@rupprecht, do you still do integration at Google? This patch might be interesting to try out, since it strengthens some warnings.



================
Comment at: clang/test/SemaCXX/warn-thread-safety-analysis.cpp:85-86
 
+template<typename T, typename U>
+U& operator->*(const SmartPtr<T>& ptr, U T::*p) { return ptr->*p; }
+
----------------
In case you're wondering, making this a member function prevents instantiating the class with non-class types:

```
error: member pointer refers into non-class type 'int'
  U& operator->*(U T::*p) const { return ptr_->*p; }
                      ^
note: in instantiation of template class 'SmartPtr<int>' requested here
SmartPtr<int> p;
              ^
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124966/new/

https://reviews.llvm.org/D124966



More information about the cfe-commits mailing list