summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaInit.cpp
diff options
context:
space:
mode:
authorJeffrey Yasskin <jyasskin@google.com>2011-08-30 22:25:41 +0000
committerJeffrey Yasskin <jyasskin@google.com>2011-08-30 22:25:41 +0000
commit924255875e31f16a61084b1acd6536184343a372 (patch)
treedaf0e2e281002c55d917f3f869d99149708d464f /clang/lib/Sema/SemaInit.cpp
parentfdf3cd7f2bb8f86f7f445ae5d741d430480f0640 (diff)
downloadbcm5719-llvm-924255875e31f16a61084b1acd6536184343a372.tar.gz
bcm5719-llvm-924255875e31f16a61084b1acd6536184343a372.zip
Fix PR10694: Boolean conversions can be from pointers, and those conversions
aren't considered narrowing conversions. llvm-svn: 138838
Diffstat (limited to 'clang/lib/Sema/SemaInit.cpp')
-rw-r--r--clang/lib/Sema/SemaInit.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index 7a6134453b5..06d530f007b 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -2340,6 +2340,11 @@ bool InitializationSequence::endsWithNarrowing(ASTContext &Ctx,
// conversion will fit into the target type and will produce the original
// value when converted back to the original type.
case ICK_Boolean_Conversion: // Bools are integers too.
+ if (!FromType->isIntegralOrUnscopedEnumerationType()) {
+ // Boolean conversions can be from pointers and pointers to members
+ // [conv.bool], and those aren't considered narrowing conversions.
+ return false;
+ } // Otherwise, fall through to the integral case.
case ICK_Integral_Conversion: {
assert(FromType->isIntegralOrUnscopedEnumerationType());
assert(ToType->isIntegralOrUnscopedEnumerationType());
OpenPOWER on IntegriCloud