sajty/ember — comment on commit 6a30ef9cba35617598ec84978df32966e2af17b9
File:  line 0
By sajty:

boost::any can't do it too.
There are lot of talks here: http://boost.2283326.n4.nabble.com/DynamicAny-Feedback-td3334680.html
C++ can't handle it, because you don't know the offset at run-time.
however boost::any would not allow to create invalid object pointers.
if you first cast it to IHeightProvider* and then to boost::any it would work. Just like I did with static_cast.

I don't think gcc has done any smart thing, because static_cast is just static: Hard coded ADD instructiuon and there isn't any runtime checks like by dynamic_cast.
So I assume this function was never working properly even on gcc.
C++ is optimized for performance.
Compiler tries to be smart, but the generated code is mostly simple and fast.