| Summary: | false "No return ..." positive if statement following a throw | ||
|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Jens Elmenthaler <jens.elmenthaler> |
| Component: | cdt-codan | Assignee: | CDT Codan Inbox <cdt-codan-inbox> |
| Status: | CLOSED DUPLICATE | QA Contact: | Elena Laskavaia <elaskavaia.cdt> |
| Severity: | normal | ||
| Priority: | P3 | CC: | cdtdoug, yevshif, zeratul976 |
| Version: | 8.0 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
Duplicate of bug 348386. *** This bug has been marked as a duplicate of bug 348386 *** |
Build Identifier: HEAD In the following code, a false positive for "No return, in function returning non-void" is reported: int testReturnChecker() { throw 42; ; } Reproducible: Always Steps to Reproduce: This example may seem stupid at a first glance. However consider an application where you want to log each thrown exception. We do it by defining a macro like this #defing MY_THROW(_e, _txt_expr) { \ stringstream buffer; \ buffer << _txt_expr; \ log(_e, buffer.str(), __FILE__, __LINE__); \ throw _e; \ } For readability reasons, the caller should be able to terminate the call to MY_THROW with a trailing semicolon: MY_THROW(e);