[clang-tools-extra] [clang-tidy] Create bugprone-public-enable-shared-from-this check (PR #102299)

via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 8 07:07:50 PDT 2024


================
@@ -0,0 +1,34 @@
+.. title:: clang-tidy - bugprone-incorrect-enable-shared-from-this
+
+bugprone-incorrect-enable-shared-from-this
+=======================================
+
+Check if class/struct publicly derives from ``std::enable_shared_from_this``,
+because otherwise when ``shared_from_this`` is called it will throw 
+``std::bad_weak_ptr``. Issues a ``FixItHint`` that can be applied.
----------------
EugeneZelenko wrote:

Last statement is not needed, this information is provided in list of checks.

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


More information about the cfe-commits mailing list