[LLVMbugs] [Bug 16984] New: clang not devirtualizing final methods based on anonymous namespace info
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Aug 23 11:57:30 PDT 2013
http://llvm.org/bugs/show_bug.cgi?id=16984
Bug ID: 16984
Summary: clang not devirtualizing final methods based on
anonymous namespace info
Product: clang
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: unassignedclangbugs at nondot.org
Reporter: clattner at apple.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
Consider:
class C1 {
virtual void bar();
virtual void baz();
};
namespace {
class C2 : public C1 {
void bar() { baz(); }
void baz() {}
};
}
C1 *test() { return new C2(); }
Clang currently doesn't devirtualize the call from bar() to baz() in C2...
unless you mark C2 with the C++11 "final" attribute. The compiler should be
able to infer "finalness" of the class in this case. This matters for
codebases like LLVM's that are C++'98 and use anonymous namespaces a lot.
--
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/20130823/dd2fff5b/attachment.html>
More information about the llvm-bugs
mailing list