https://llvm.org/bugs/show_bug.cgi?id=23789
Bug ID: 23789
Summary: clang should warn on "trivially" self-recursive
functions
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
Consider this common pattern:
class Frame {
Frame* FindFrame(uint32_t id) {
return const_cast<Frame*>(const_cast<const Frame*>(this))->FindFrame(id);
}
const Frame* FindFrame(uint32_t id) const;
};
The parens in the inlined functions are off, it needs to be:
return const_cast<Frame*>(const_cast<const Frame*>(this)->FindFrame(id));
cl.exe finds this:
e:\b\build\slave\win_x64_gn\build\src\mandoline\tab\frame.h(58) : warning
C4717: 'mandoline::Frame::FindFrame' : recursive on all control paths, function
will cause runtime stack overflow
clang doesn't. It should.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs