Patch to fix downcasts which results in errors when using Clang with c++11.