[llvm-commits] [llvm] r95585 - /llvm/trunk/include/llvm/Support/Casting.h
Chris Lattner
sabre at nondot.org
Mon Feb 8 14:05:38 PST 2010
Author: lattner
Date: Mon Feb 8 16:05:38 2010
New Revision: 95585
URL: http://llvm.org/viewvc/llvm-project?rev=95585&view=rev
Log:
use a c-style cast instead of reinterpret-cast, as sometimes the
cast needs to adjust for a vtable pointer when going from base to
derived type (when the base doesn't have a vtable but the
derived type does).
Modified:
llvm/trunk/include/llvm/Support/Casting.h
Modified: llvm/trunk/include/llvm/Support/Casting.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Casting.h?rev=95585&r1=95584&r2=95585&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Casting.h (original)
+++ llvm/trunk/include/llvm/Support/Casting.h Mon Feb 8 16:05:38 2010
@@ -180,8 +180,9 @@
template<class To, class FromTy> struct cast_convert_val<To,FromTy,FromTy> {
// This _is_ a simple type, just cast it.
static typename cast_retty<To, FromTy>::ret_type doit(const FromTy &Val) {
- return reinterpret_cast<typename cast_retty<To, FromTy>::ret_type>(
- const_cast<FromTy&>(Val));
+ typename cast_retty<To, FromTy>::ret_type Res2
+ = (typename cast_retty<To, FromTy>::ret_type)const_cast<FromTy&>(Val);
+ return Res2;
}
};
More information about the llvm-commits
mailing list