<html>
<head>
<base href="http://bugs.llvm.org/">
</head>
<body><span class="vcard"><a class="email" href="mailto:rnk@google.com" title="Reid Kleckner <rnk@google.com>"> <span class="fn">Reid Kleckner</span></a>
</span> changed
<a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - virtual destructor not called"
href="http://bugs.llvm.org/show_bug.cgi?id=32837">bug 32837</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>---
</td>
<td>INVALID
</td>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>NEW
</td>
<td>RESOLVED
</td>
</tr>
<tr>
<td style="text-align:right;">CC</td>
<td>
</td>
<td>rnk@google.com
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - virtual destructor not called"
href="http://bugs.llvm.org/show_bug.cgi?id=32837#c2">Comment # 2</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - virtual destructor not called"
href="http://bugs.llvm.org/show_bug.cgi?id=32837">bug 32837</a>
from <span class="vcard"><a class="email" href="mailto:rnk@google.com" title="Reid Kleckner <rnk@google.com>"> <span class="fn">Reid Kleckner</span></a>
</span></b>
<pre>I believe the sample code has UB. Array delete isn't polymorphic, you can't
delete an array of S2 objects as a pointer to an array of S objects. Consider
how this would go wrong for a two-element array when sizeof(S2) != sizeof(S):
struct S { virtual ~S(); };
struct S2 { virtual ~S2() { __builtin_printf("asdf\n"); } int grow; };
int main() { delete [] static_cast<S *>(new S2[2]); }</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>