V741. The following pattern is used: throw (a, b);. It is possible that type name was omitted: throw MyException(a, b);.

The analyzer detected the throw keyword followed by a pair of parentheses with various values inside separated by commas. It is very likely that the programmer forgot to specify the type of the exception to be thrown.

Consider the following example:

throw ("foo", 123);

Although the code looks strange, it compiles successfully. In this case, executing the comma operator ',' results in the value 123. Therefore, an exception of type 'int' will be thrown.

In other words, the code above is equivalent to the following:

throw 123;

Correct code:

throw MyException("foo", 123);

According to Common Weakness Enumeration, potential errors found by using this diagnostic are classified as CWE-480.

Bugs Found

Checked Projects
Collected Errors
13 926