用 delete 释放数组漏写中括号,用 delete 释放对象多写中括号,用 delete 释放非 new 表达式的结果
C++-Undefined-Behavior-39
示例:
string object;
delete &object; // Undefined behavior
delete "string"; // Undefined behavior
delete new int[n]; // Undefined behavior
delete[] new int(n); // Undefined behavior
依据
ISO/IEC 14882:2003 5.3.5(2)-undefined
ISO/IEC 14882:2011 5.3.5(2)-undefined