You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
structBase
{
int i;
};
structDerived : Base
{
float f;
};
intmain()
{
Derived d1;
Base& base = d1;
Derived& d2 = static_cast<Derived&>(base);
}
cppcoreguidelines-pro-type-static-cast-downcast emits a warning even when the base class is not polymorphic. In the above case the static_cast is necessary to cast from base to derived since a dynamic_cast is not allowed.