| Summary: | False positive warning about return value with try/catch | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Nathan Ridge <zeratul976> | ||||
| 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, malaperle, yevshif | ||||
| Version: | 8.0 | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Created attachment 223553 [details]
patch that fixes the issue, including tests
Attached is a patch that fixes the issue, including tests.
Thank you for the patch! Unfortunately, there was already a similar bug reported also with a patch. I will look at both patches. *** This bug has been marked as a duplicate of bug 348387 *** |
For the following code: bool f() { try { return true; } catch (...) { return false; } } Codan produces the warning: "Warning: no return in function returning non-void" However, quite obviously all code paths lead to a value being returned. gcc with -Wall produces no warning for the same code.