[lld] r229426 - MSVC no longer requires the explicit cast operation to obtain a function pointer from this capture-less lambda. NFC.

Aaron Ballman aaron at aaronballman.com
Mon Feb 16 11:38:53 PST 2015


Author: aaronballman
Date: Mon Feb 16 13:38:52 2015
New Revision: 229426

URL: http://llvm.org/viewvc/llvm-project?rev=229426&view=rev
Log:
MSVC no longer requires the explicit cast operation to obtain a function pointer from this capture-less lambda. NFC.

Modified:
    lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp

Modified: lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp?rev=229426&r1=229425&r2=229426&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp Mon Feb 16 13:38:52 2015
@@ -653,13 +653,8 @@ std::error_code FileCOFF::AtomizeDefined
   // Sort symbols by position.
   std::stable_sort(
       symbols.begin(), symbols.end(),
-      // For some reason MSVC fails to allow the lambda in this context with a
-      // "illegal use of local type in type instantiation". MSVC is clearly
-      // wrong here. Force a conversion to function pointer to work around.
-      static_cast<bool (*)(llvm::object::COFFSymbolRef,
-                           llvm::object::COFFSymbolRef)>(
-          [](llvm::object::COFFSymbolRef a, llvm::object::COFFSymbolRef b)
-              -> bool { return a.getValue() < b.getValue(); }));
+      [](llvm::object::COFFSymbolRef a, llvm::object::COFFSymbolRef b)
+          -> bool { return a.getValue() < b.getValue(); });
 
   StringRef sectionName;
   if (std::error_code ec = _obj->getSectionName(section, sectionName))





More information about the llvm-commits mailing list