------- Comment #4 from jason at gcc dot gnu dot org 2007-09-05 16:08 ------- The reduced testcase breaks in the same way with ICC 10.0.023 if I add a user-defined operator delete to B2. If I add it to D instead, ICC incorrectly calls the user-defined delete instead of the global delete in the calls to f2 and f3.
This seems to be a standards and/or ABI problem. The standard clearly states that the global delete will be used if you say ::delete, but the C++ ABI doesn't provide any mechanism for that. EDG seem to be trying to split the difference by using the deleting destructor if the static type doesn't have an operator delete, but that's wrong if the dynamic type of the object does. It seems that the solution would be to return the true address as void* from a virtual destructor, or add another deleting destructor that uses the global operator delete. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15097