Add another case to the whitelist of cast kinds that can convert to bool.

Fixes PR8608.

llvm-svn: 119293
This commit is contained in:
John McCall 2010-11-16 00:12:50 +00:00
parent a4c27ec73b
commit 36459fdbad
2 changed files with 6 additions and 2 deletions

View File

@ -1974,7 +1974,6 @@ private:
// These should not have an inheritance path.
case CK_BitCast:
case CK_LValueBitCast:
case CK_Dynamic:
case CK_ToUnion:
case CK_ArrayToPointerDecay:
@ -2007,13 +2006,14 @@ private:
case CK_Dependent:
case CK_Unknown:
case CK_NoOp:
case CK_UserDefinedConversion:
case CK_PointerToBoolean:
case CK_IntegralToBoolean:
case CK_FloatingToBoolean:
case CK_MemberPointerToBoolean:
case CK_FloatingComplexToBoolean:
case CK_IntegralComplexToBoolean:
case CK_LValueBitCast: // -> bool&
case CK_UserDefinedConversion: // operator bool()
assert(path_empty() && "Cast kind should not have a base path!");
break;
}

View File

@ -130,3 +130,7 @@ namespace PR7149 {
X0< const int[1]> c(p1);
}
}
namespace PR8608 {
bool& f(unsigned char& c) { return (bool&)c; }
}