diff options
author | David Majnemer <david.majnemer@gmail.com> | 2015-06-30 03:30:26 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2015-06-30 03:30:26 +0000 |
commit | 25c4b570fc0cd86124befc713d9bcc05ac0a4dbd (patch) | |
tree | 4377161cfe459ecc03e6bae532e9fd5f28fbf3c1 /test/CodeGenCXX | |
parent | 8eb384a97cfdc244a5ab81026677bcbaf8cf2ecf (diff) | |
download | clang-25c4b570fc0cd86124befc713d9bcc05ac0a4dbd.tar.gz |
[MS ABI] Workaround corner-case bug in the ABI for operator delete
MSVC only genreates array cookies if the class has a destructor. This
is problematic when having to call T::operator delete[](void *, size_t)
because the second argument's argument is impossible to synthesize
correctly if the class has no destructor (because there will be no array
cookie).
Instead, MSVC passes the size of the class. Do the same, for
compatibility, instead of crashing.
This fixes PR23990.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241038 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX')
-rw-r--r-- | test/CodeGenCXX/microsoft-abi-array-cookies.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/CodeGenCXX/microsoft-abi-array-cookies.cpp b/test/CodeGenCXX/microsoft-abi-array-cookies.cpp index 619b1b8a94..62ead4fb69 100644 --- a/test/CodeGenCXX/microsoft-abi-array-cookies.cpp +++ b/test/CodeGenCXX/microsoft-abi-array-cookies.cpp @@ -58,4 +58,14 @@ void check_array_cookies_aligned() { // CHECK: getelementptr inbounds i8, i8* [[ARRAY_AS_CHAR]], i64 -8 } +namespace PR23990 { +struct S { + char x[42]; + void operator delete[](void *p, __SIZE_TYPE__); + // CHECK-LABEL: define void @"\01?delete_s@PR23990@@YAXPAUS@1@@Z"( + // CHECK: call void @"\01??_VS@PR23990@@SAXPAXI@Z"(i8* {{.*}}, i32 42) +}; +void delete_s(S *s) { delete[] s; } +} + // CHECK: attributes [[NUW]] = { nounwind{{.*}} } |