aboutsummaryrefslogtreecommitdiff
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
commit5082d34e4107a44ac7f07b62f7a6c917e0e6e71e (patch)
tree1c4ea49b1b332dd0a549b9c90724c16dc85cf3af
parentd1ded66c4eda8d170222071dec7ebba78bd86ea4 (diff)
Add another case to the whitelist of cast kinds that can convert to bool.
Fixes PR8608. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119293 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/AST/Expr.h4
-rw-r--r--test/SemaCXX/references.cpp4
2 files changed, 6 insertions, 2 deletions
diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h
index fb603165d6..7e67dde57b 100644
--- a/include/clang/AST/Expr.h
+++ b/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/test/SemaCXX/references.cpp b/test/SemaCXX/references.cpp
index 996e7da90b..ab44e78453 100644
--- a/test/SemaCXX/references.cpp
+++ b/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; }
+}