]> granicus.if.org Git - clang/commitdiff
Add another case to the whitelist of cast kinds that can convert to bool.
authorJohn McCall <rjmccall@apple.com>
Tue, 16 Nov 2010 00:12:50 +0000 (00:12 +0000)
committerJohn McCall <rjmccall@apple.com>
Tue, 16 Nov 2010 00:12:50 +0000 (00:12 +0000)
Fixes PR8608.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119293 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Expr.h
test/SemaCXX/references.cpp

index fb603165d6498c3cecb7c141e3d3e54c099ecc09..7e67dde57b89dfed4cd54851ac9c62ffebb65cfe 100644 (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;
     }
index 996e7da90b4ca784ef1b6195e55d629aa3f4597b..ab44e78453b2cfdbb7eda4da841eb1c40cdaed6f 100644 (file)
@@ -130,3 +130,7 @@ namespace PR7149 {
     X0< const int[1]> c(p1);
   }
 }
+
+namespace PR8608 {
+  bool& f(unsigned char& c) { return (bool&)c; }
+}