This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/71900] New: Final keyword does not work as intended.


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]