http://bugs.llvm.org/show_bug.cgi?id=32837

Reid Kleckner <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED
                 CC|                            |[email protected]

--- Comment #2 from Reid Kleckner <[email protected]> ---
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]); }

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to