[IR] Fixed ambiguous call to llvm::report_fatal_error
authorDmitry Vassiliev <dvassiliev@accesssoftek.com>
Sat, 23 Jul 2022 14:28:18 +0000 (16:28 +0200)
committerDmitry Vassiliev <dvassiliev@accesssoftek.com>
Sat, 23 Jul 2022 14:28:18 +0000 (16:28 +0200)
This patch fixes the following error with MSVC 16.9.2:
llvm/lib/IR/GCStrategy.cpp(35): error C2668: 'llvm::report_fatal_error': ambiguous call to overloaded function
llvm/include/llvm/Support/ErrorHandling.h(75): note: could be 'void llvm::report_fatal_error(const llvm::Twine &,bool)'
llvm/include/llvm/Support/ErrorHandling.h(73): note: or 'void llvm::report_fatal_error(llvm::StringRef,bool)'
llvm/lib/IR/GCStrategy.cpp(35): note: while trying to match the argument list '(const std::string)'

Reviewed By: RKSimon, barannikov88

Differential Revision: https://reviews.llvm.org/D130407

llvm/lib/IR/GCStrategy.cpp

index f3bc5b7..5833dc2 100644 (file)
@@ -12,6 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/IR/GCStrategy.h"
+#include "llvm/ADT/Twine.h"
 
 using namespace llvm;
 
@@ -32,7 +33,7 @@ std::unique_ptr<GCStrategy> llvm::getGCStrategy(const StringRef Name) {
     const std::string error =
         std::string("unsupported GC: ") + Name.str() +
         " (did you remember to link and initialize the library?)";
-    report_fatal_error(error);
+    report_fatal_error(Twine(error));
   } else
-    report_fatal_error(std::string("unsupported GC: ") + Name.str());
+    report_fatal_error(Twine(std::string("unsupported GC: ") + Name.str()));
 }