From: Benjamin Kramer Date: Tue, 16 Sep 2014 15:26:41 +0000 (+0000) Subject: Interpreter: Hack around a series of bugs in MSVC 2012 that copies around this X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a9478c4a962043b739f353b7d4e8b9977dfa7974;p=llvm Interpreter: Hack around a series of bugs in MSVC 2012 that copies around this move-only struct. I feel terrible now, but at least it's shielded away from proper compilers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217875 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/ExecutionEngine/Interpreter/Interpreter.h b/lib/ExecutionEngine/Interpreter/Interpreter.h index 9715e71e859..282b1e04bea 100644 --- a/lib/ExecutionEngine/Interpreter/Interpreter.h +++ b/lib/ExecutionEngine/Interpreter/Interpreter.h @@ -42,11 +42,17 @@ class AllocaHolder { public: AllocaHolder() {} // Make this type move-only. - AllocaHolder(AllocaHolder &&RHS) : Allocations(std::move(RHS.Allocations)) {} - AllocaHolder &operator=(AllocaHolder &&RHS) { - Allocations = std::move(RHS.Allocations); +#if defined(_MSC_VER) && _MSC_VER < 1800 + // Hack around bugs in MSVC 2012. It always tries to copy this class. + AllocaHolder(const AllocaHolder &RHS) + : Allocations(std::move(const_cast(RHS).Allocations)) {} + AllocaHolder &operator=(const AllocaHolder &RHS) { + Allocations = std::move(const_cast(RHS).Allocations); return *this; } +#else + AllocaHolder(AllocaHolder &&RHS) = default; +#endif ~AllocaHolder() { for (void *Allocation : Allocations)