Community
Participate
Working Groups
Build Identifier: 201106081058 the code below yields a false positive for "No return, in function returning non-void" for the get_for_update() method: void throw_is_immutable(const int val); int get_for_update(void) { throw_is_immutable(); } void throw_is_immutable(void) { throw; } Reproducible: Always
So does GCC 4.5 :) It could be the case that similarly to as explained in bug 346557, we should prefer to use attributes for that (that is, GCC's __attribute__ ((noreturn)) or C++0x's [[noreturn]] ). Might be worth a discussion.
I get the same warning in a simpler case: std::string As_String( int i ) { try { return strs[type]; } catch(...) { return as_string( type ); } }
Even simpler ;-) int CTraceError () { try { return 0; } catch (...) { return 1; } }
The examples in comment 2 and comment 3 are duplicates of bug 348387, which has been fixed. Regarding the example in comment 0, we don't warn if the function is marked __attribute__((noreturn)). This matches the behaviour of GCC. I think this bug can be closed.
This was fixed a while ago.