diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-02-09 01:03:42 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-02-09 01:03:42 +0000 |
commit | bca133d0bb77f30b9866e6ec095e17914f185f04 (patch) | |
tree | 7348a5611f7d5a7d812a982940601bb79aa20eff /unittests/Support/TrailingObjectsTest.cpp | |
parent | 9f15b40ef79df5fc966f50fc2c97d9f4fd0df47a (diff) |
Re-commit r259942 (reverted in r260053) with a different workaround for the MSVC bug.
This fixes undefined behavior in C++14 due to the size of the object being
deleted being different from sizeof(dynamic type) when it is allocated with
trailing objects.
MSVC seems to have several bugs around using-declarations changing the access
of a member inherited from a base class, so use forwarding functions instead of
using-declarations to make TrailingObjects::operator delete accessible where
desired.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260180 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Support/TrailingObjectsTest.cpp')
-rw-r--r-- | unittests/Support/TrailingObjectsTest.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/unittests/Support/TrailingObjectsTest.cpp b/unittests/Support/TrailingObjectsTest.cpp index 170cbc372b8..282f402ec8e 100644 --- a/unittests/Support/TrailingObjectsTest.cpp +++ b/unittests/Support/TrailingObjectsTest.cpp @@ -34,6 +34,7 @@ public: void *Mem = ::operator new(totalSizeToAlloc<short>(NumShorts)); return new (Mem) Class1(ShortArray, NumShorts); } + void operator delete(void *p) { TrailingObjects::operator delete(p); } short get(unsigned Num) const { return getTrailingObjects<short>()[Num]; } @@ -78,6 +79,7 @@ public: *C->getTrailingObjects<double>() = D; return C; } + void operator delete(void *p) { TrailingObjects::operator delete(p); } short getShort() const { if (!HasShort) |