enhance bits_storage to work with enums by using a c-style

cast instead of reinterpret_cast, fixing PR6243.  Apparently
reinterpret_cast and I aren't getting along today.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95622 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2010-02-09 00:05:45 +00:00
parent 5938a3e681
commit 47afe4e806

View File

@ -1168,7 +1168,7 @@ class bits_storage<DataType, bool> {
template<class T>
static unsigned Bit(const T &V) {
unsigned BitPos = reinterpret_cast<unsigned>(V);
unsigned BitPos = (unsigned)V;
assert(BitPos < sizeof(unsigned) * CHAR_BIT &&
"enum exceeds width of bit vector!");
return 1 << BitPos;