[LLVMbugs] [Bug 23789] New: clang should warn on "trivially" self-recursive functions
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Jun 8 14:39:05 PDT 2015
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: unassignedclangbugs at nondot.org
Reporter: nicolasweber at gmx.de
CC: llvmbugs at cs.uiuc.edu
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150608/5298adce/attachment.html>
More information about the llvm-bugs
mailing list