W8131 Casting Delphi-style class '%s' to an interface. Use 'System::interface_cast<%s>(cls)' instead (C++)

From RAD Studio
Jump to: navigation, search

Go Up to Compiler Errors And Warnings (C++) Index


This occurs when casting a class to an interface using the type casting operator.

#include <System.hpp>
class TMyClass : public TObject
{
};
IUnknown* f(TMyClass* c)
{
  return dynamic_cast<IUnknown*>(c);  // <-- W8131
}