[cfe-commits] r119293 - in /cfe/trunk: include/clang/AST/Expr.h test/SemaCXX/references.cpp

John McCall rjmccall at apple.com
Mon Nov 15 16:12:50 PST 2010


Author: rjmccall
Date: Mon Nov 15 18:12:50 2010
New Revision: 119293

URL: http://llvm.org/viewvc/llvm-project?rev=119293&view=rev
Log:
Add another case to the whitelist of cast kinds that can convert to bool.
Fixes PR8608.


Modified:
    cfe/trunk/include/clang/AST/Expr.h
    cfe/trunk/test/SemaCXX/references.cpp

Modified: cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=119293&r1=119292&r2=119293&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Mon Nov 15 18:12:50 2010
@@ -1974,7 +1974,6 @@
 
     // 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 @@
     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;
     }

Modified: cfe/trunk/test/SemaCXX/references.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/references.cpp?rev=119293&r1=119292&r2=119293&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/references.cpp (original)
+++ cfe/trunk/test/SemaCXX/references.cpp Mon Nov 15 18:12:50 2010
@@ -130,3 +130,7 @@
     X0< const int[1]> c(p1);
   }
 }
+
+namespace PR8608 {
+  bool& f(unsigned char& c) { return (bool&)c; }
+}





More information about the cfe-commits mailing list