xref: /llvm-project/clang-tools-extra/docs/clang-tidy/checks/bugprone/throw-keyword-missing.rst (revision 6e566bc5523f743bc34a7e26f050f1f2b4d699a8)
1.. title:: clang-tidy - bugprone-throw-keyword-missing
2
3bugprone-throw-keyword-missing
4==============================
5
6Warns about a potentially missing ``throw`` keyword. If a temporary object is created, but the
7object's type derives from (or is the same as) a class that has 'EXCEPTION', 'Exception' or
8'exception' in its name, we can assume that the programmer's intention was to throw that object.
9
10Example:
11
12.. code-block:: c++
13
14  void f(int i) {
15    if (i < 0) {
16      // Exception is created but is not thrown.
17      std::runtime_error("Unexpected argument");
18    }
19  }
20
21
22