http://llvm.org/bugs/show_bug.cgi?id=12459
Bug #: 12459 Summary: False positive for call to pure virtual member function warning caused by a cast Product: clang Version: trunk Platform: Other OS/Version: Linux Status: NEW Severity: normal Priority: P Component: -New Bugs AssignedTo: unassignedclangb...@nondot.org ReportedBy: l.lu...@suse.cz CC: llvmbugs@cs.uiuc.edu Classification: Unclassified $ cat a.cpp struct A { virtual void foo() = 0; }; struct B : A { B(); virtual void foo(); }; B::B() { static_cast< A* >( this )->foo(); } void B::foo() {} int main() { B b; } $ clang++ -v clang version 3.1 (trunk 153819) Target: x86_64-unknown-linux-gnu Thread model: posix $ clang++ a.cpp a.cpp:3:10: warning: call to pure virtual member function 'foo'; overrides of 'foo' in subclasses are not available in the constructor of 'A' B::B() { static_cast< A* >( this )->foo(); } ^ a.cpp:1:12: note: 'foo' declared here struct A { virtual void foo() = 0; }; ^ 1 warning generated. $ ./a.out [no abort, runs fine] Stepping through or even just running this testcase shows that B::B() calls B::foo() and not A::foo(), despite the explicit cast and the warning. The false warning is not generated without the explicit cast. -- Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug. _______________________________________________ LLVMbugs mailing list LLVMbugs@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs