[Bug c++/71900] New: Final keyword does not work as intended.
pavan.narasimhaprasad at hughes dot com
gcc-bugzilla@gcc.gnu.org
Fri Jul 15 21:51:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71900
Bug ID: 71900
Summary: Final keyword does not work as intended.
Product: gcc
Version: 4.9.2
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: pavan.narasimhaprasad at hughes dot com
Target Milestone: ---
Created attachment 38914
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38914&action=edit
override_error.cpp
File: override_error.cpp
When a virtual method print() in Class A is declared as final and when
inherited in the Class B, overriding this method is not generating a
compilation error.
g++ -std=c++11 override_error.cpp
File: overrride.cpp
When virtual method print() in Class A is defined within the class and when
inherited in the Class B, overriding this method is generating a compilation
error as expected.
g++ -std=c++11 override.cpp
verride.cpp:29:15: error: virtual function 'virtual void B::printVal()'
void printVal() override;
^
override.cpp:13:22: error: overriding final function 'virtual void
A::printVal()'
virtual void printVal() final
More information about the Gcc-bugs
mailing list