Deleting forward declared pointers leads to undefined behavior.
Examples:
However, my Visual Studio (VS2012) compiler doesn't warn me about it.
- Is this an unfixed VS2012 compiler bug?
- Did I disable (or never enable) the corresponding warning?
- Is this specific to some project setting?
- Visual Leak Detector hinted me to the problem, but is there some method (pragma, code, macro, ...) to detect this at compile time?
The respective warning is
C4150
.It should be active by default and it is categorized in warning level 2 (which should be active too, since default warning level is
W3
afaik).Note: Instead of lowering the warning level, try to pragma warnings in specific cases.