Compiler Error C2683
'cast' : 'type' is not a polymorphic type
You cannot use dynamic_cast to convert from a non-polymorphic class (a class with no virtual functions).
You can use static_cast to perform conversions of non-polymorphic types. However, static_cast
does not perform a run-time check.
The following sample generates C2683:
// C2683.cpp
// compile with: /c
class B { };
class D : public B { };
void f(B* pb) {
D* pd1 = dynamic_cast<D*>(pb); // C2683
D* pd1 = static_cast<D*>(pb); // OK
}
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for