Bug #83686 Declare overridden Item member functions and final Item subclasses
Submitted: 4 Nov 2016 8:11 Modified: 10 Nov 2016 19:34
Reporter: Marko Mäkelä Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S3 (Non-critical)
Version:8.0.1 OS:Any
Assigned to: CPU Architecture:Any

[4 Nov 2016 8:11] Marko Mäkelä
Description:
When virtual member functions are being renamed or replaced, it would be extremely useful if the compiler were able to warn about member functions that were intended to be overriding a member function in a base class, but are not actually overriding anything.

The C++11 override keyword would allow this.

Furthermore, the C++11 final keyword would enable some additional optimizations, and it would make the code more readable by documenting that there cannot be any classes derived from a final class.

How to repeat:
For example, in item_xmlfunc.cc, rename one of the val_nodeset() member functions to something else, and observe that no warning is generated at compilation time. The error might only be detected by a failure of ./mtr main.xml (result difference).

Suggested fix:
Add the C++11 final and override keywords to the Item classes.
[10 Nov 2016 19:34] Paul DuBois
Posted by developer:
 
Fixed in 8.0.1.

Code cleanup. No changelog entry needed.