From 924255875e31f16a61084b1acd6536184343a372 Mon Sep 17 00:00:00 2001 From: Jeffrey Yasskin Date: Tue, 30 Aug 2011 22:25:41 +0000 Subject: Fix PR10694: Boolean conversions can be from pointers, and those conversions aren't considered narrowing conversions. llvm-svn: 138838 --- clang/lib/Sema/SemaInit.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'clang/lib/Sema/SemaInit.cpp') 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()); -- cgit v1.2.3