c++visual-c++compiler-warnings

Why is VC++ C4150 (deletion of pointer to incomplete type) only a warning?


Of course, warning must be treated, but why is VC++ C4150 (deletion of pointer to incomplete type) only a warning?


Solution

  • Because standard says it's legal, although dangerous: 5.3.5

    If the object being deleted has incomplete class type at the point of deletion and the complete class has a non-trivial destructor or a deallocation function, the behavior is undefined.