summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-11-16 00:12:50 +0000
committerJohn McCall <rjmccall@apple.com>2010-11-16 00:12:50 +0000
commit36459fdbad2c40f260e9a2912bc090ddd2524f85 (patch)
tree91d55d85d626946dd7657b36b07bdc846791d1ab
parenta4c27ec73bc51ad0d614ad5ec82208f18c334511 (diff)
downloadbcm5719-llvm-36459fdbad2c40f260e9a2912bc090ddd2524f85.tar.gz
bcm5719-llvm-36459fdbad2c40f260e9a2912bc090ddd2524f85.zip
Add another case to the whitelist of cast kinds that can convert to bool.
Fixes PR8608. llvm-svn: 119293
-rw-r--r--clang/include/clang/AST/Expr.h4
-rw-r--r--clang/test/SemaCXX/references.cpp4
2 files changed, 6 insertions, 2 deletions
diff --git a/clang/include/clang/AST/Expr.h b/clang/include/clang/AST/Expr.h
index fb603165d64..7e67dde57b8 100644
--- a/clang/include/clang/AST/Expr.h
+++ b/clang/include/clang/AST/Expr.h
@@ -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;
}
diff --git a/clang/test/SemaCXX/references.cpp b/clang/test/SemaCXX/references.cpp
index 996e7da90b4..ab44e78453b 100644
--- a/clang/test/SemaCXX/references.cpp
+++ b/clang/test/SemaCXX/references.cpp
@@ -130,3 +130,7 @@ namespace PR7149 {
X0< const int[1]> c(p1);
}
}
+
+namespace PR8608 {
+ bool& f(unsigned char& c) { return (bool&)c; }
+}
OpenPOWER on IntegriCloud