[llvm] 4acc023 - [IR] Fixed ambiguous call to llvm::report_fatal_error

Dmitry Vassiliev via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 23 07:28:30 PDT 2022


Author: Dmitry Vassiliev
Date: 2022-07-23T16:28:18+02:00
New Revision: 4acc02357e58b1299f0d7d7d734dfb7075df87da

URL: https://github.com/llvm/llvm-project/commit/4acc02357e58b1299f0d7d7d734dfb7075df87da
DIFF: https://github.com/llvm/llvm-project/commit/4acc02357e58b1299f0d7d7d734dfb7075df87da.diff

LOG: [IR] Fixed ambiguous call to llvm::report_fatal_error

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

Added: 
    

Modified: 
    llvm/lib/IR/GCStrategy.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/GCStrategy.cpp b/llvm/lib/IR/GCStrategy.cpp
index f3bc5b74f8fd3..5833dc26c57ea 100644
--- a/llvm/lib/IR/GCStrategy.cpp
+++ b/llvm/lib/IR/GCStrategy.cpp
@@ -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()));
 }


        


More information about the llvm-commits mailing list