Bug #86886 implement down_cast correctly
Submitted: 30 Jun 2017 13:08 Modified: 11 Oct 2017 13:07
Reporter: Martin Hansson Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: Optimizer Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[30 Jun 2017 13:08] Martin Hansson
This is an internal refactoring.

How to repeat:
Currently can't do this:

My_descendent & md= ...;
My_base & mb = md;
auto md2 = down_cast<My_descendent&>(mb);

Suggested fix:
down_cast() has the wrong signature. See extra/protobuf/protobuf-2.6.1/src/google/protobuf/stubs/common.h for the correct way. Once this is fixed, we need another overload for references. This is because down_cast behaves differently for references than for pointers. For pointers, nullptr is returned in case of illegal casts, for references, bad_cast is thrown.
[11 Oct 2017 13:07] Paul DuBois
Posted by developer:
Fixed in 9.0.0.

Code cleanup. No changelog entry needed.