r335577 - Fix an ambiguous overload issue pointed out by MSVC

Vedant Kumar via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 25 20:53:06 PDT 2018


Author: vedantk
Date: Mon Jun 25 20:53:06 2018
New Revision: 335577

URL: http://llvm.org/viewvc/llvm-project?rev=335577&view=rev
Log:
Fix an ambiguous overload issue pointed out by MSVC

Log:
http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/11390

Modified:
    cfe/trunk/include/clang/Basic/Specifiers.h
    cfe/trunk/lib/Sema/SemaLambda.cpp

Modified: cfe/trunk/include/clang/Basic/Specifiers.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Specifiers.h?rev=335577&r1=335576&r2=335577&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Specifiers.h (original)
+++ cfe/trunk/include/clang/Basic/Specifiers.h Mon Jun 25 20:53:06 2018
@@ -296,7 +296,7 @@ namespace clang {
 
   /// Return true if \p L has a weaker nullability annotation than \p R. The
   /// ordering is: Unspecified < Nullable < NonNull.
-  inline bool operator<(NullabilityKind L, NullabilityKind R) {
+  inline bool hasWeakerNullability(NullabilityKind L, NullabilityKind R) {
     return uint8_t(L) > uint8_t(R);
   }
 

Modified: cfe/trunk/lib/Sema/SemaLambda.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLambda.cpp?rev=335577&r1=335576&r2=335577&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLambda.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLambda.cpp Mon Jun 25 20:53:06 2018
@@ -712,7 +712,8 @@ void Sema::deduceClosureReturnType(Captu
       auto RetTyNullability = ReturnType->getNullability(Ctx);
       auto BlockNullability = CSI.ReturnType->getNullability(Ctx);
       if (BlockNullability &&
-          (!RetTyNullability || *RetTyNullability < *BlockNullability))
+          (!RetTyNullability ||
+           hasWeakerNullability(*RetTyNullability, *BlockNullability)))
         CSI.ReturnType = ReturnType;
       continue;
     }




More information about the cfe-commits mailing list