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: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs