| 1 |
.. title:: clang-tidy - bugprone-throw-keyword-missing |
| 2 |
|
| 3 |
bugprone-throw-keyword-missing |
| 4 |
============================== |
| 5 |
|
| 6 |
Warns about a potentially missing ``throw`` keyword. If a temporary object is created, but the |
| 7 |
object'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 |
|
| 10 |
Example: |
| 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 |
|