================
@@ -0,0 +1,31 @@
+.. title:: clang-tidy - bugprone-std-exception-baseclass
+
+bugprone-std-exception-baseclass
+================================
+
+Ensure that every value that in a ``throw`` expression is an instance of
+``std::exception``.
+
+Exception types should inherit from ``std::exception`` so they can be
+handled consistently and caught as ``std::exception``.
----------------
vbvictor wrote:

This is too generic, can we:

Deriving all exceptions from ``std::exception`` ensures callers can catch every 
possible exception through a single catch block and always have access to 
``what()`` method for diagnostics. Throwing arbitrary types creates hidden 
contracts, breaks interoperability with the standard library, and risks 
triggering a program termination.

https://github.com/llvm/llvm-project/pull/183474
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to