[clang-tools-extra] [clang-tidy]add new check `bugprone-compare-pointer-to-member-virtual-function` (PR #66055)

Piotr Zegar via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 13 02:13:31 PDT 2023


================
@@ -0,0 +1,44 @@
+.. title:: clang-tidy - bugprone-compare-pointer-to-member-virtual-function
+
+bugprone-compare-pointer-to-member-virtual-function
+===================================================
+
+Detects unspecified behavior about equality comparison between pointer to member virtual 
+function and anything other than null-pointer-constant.
+
+
----------------
PiotrZSL wrote:

Add also entry about nullptr as an solution, for example:

```
In scenarios involving pointers to member virtual functions, it's advisable to employ nullptr for comparisons. This approach ensures clarity, reduces ambiguity, and promotes code safety by explicitly checking for null pointers, mitigating potential issues with unspecified behavior.
```

https://github.com/llvm/llvm-project/pull/66055


More information about the cfe-commits mailing list