diff options
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 0dffa53679e..ee0e6702e0f 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -5358,6 +5358,13 @@ void CheckImplicitConversion(Sema &S, Expr *E, QualType T, // prevented by a check in AnalyzeImplicitConversions(). return DiagnoseImpCast(S, E, T, CC, diag::warn_impcast_string_literal_to_bool); + if (isa<ObjCStringLiteral>(E) || isa<ObjCArrayLiteral>(E) || + isa<ObjCDictionaryLiteral>(E) || isa<ObjCBoxedExpr>(E)) { + // This covers the literal expressions that evaluate to Objective-C + // objects. + return DiagnoseImpCast(S, E, T, CC, + diag::warn_impcast_objective_c_literal_to_bool); + } if (Source->isFunctionType()) { // Warn on function to bool. Checks free functions and static member // functions. Weakly imported functions are excluded from the check, |