[PATCH] D109534: fixed ambiguous overload build failure

Marcelo Juchem via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 9 12:01:16 PDT 2021


juchem created this revision.
juchem added reviewers: jmorse, StephenTozer, atanasyan, grimar, Higuoxing, djtodoro.
Herald added a subscriber: hiraditya.
juchem requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

LLVM (`llvmorg-14-init`) under Debian sid using latest gcc `(Debian 10.3.0-9) 10.3.0` fails due to ambiguous overload on `operators ==` and `!=`:

  /root/src/llvm/src/llvm/tools/obj2yaml/elf2yaml.cpp:212:22:
  error: ambiguous overload for 'operator!='
  (operand types are 'llvm::ELFYAML::ELF_SHF' and 'int')

      

  /root/src/llvm/src/llvm/tools/obj2yaml/elf2yaml.cpp:204:32:
  error: ambiguous overload for 'operator!='
  (operand types are 'const llvm::yaml::Hex64' and 'int')

      

  /root/src/llvm/src/llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp:629:35:
  error: ambiguous overload for 'operator=='
  (operand types are 'const uint64_t' {aka 'const long unsigned int'} and 'llvm::Register')


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109534

Files:
  llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp
  llvm/tools/obj2yaml/elf2yaml.cpp


Index: llvm/tools/obj2yaml/elf2yaml.cpp
===================================================================
--- llvm/tools/obj2yaml/elf2yaml.cpp
+++ llvm/tools/obj2yaml/elf2yaml.cpp
@@ -201,7 +201,8 @@
     if (const ELFYAML::RawContentSection *RawSec =
             dyn_cast<const ELFYAML::RawContentSection>(&S)) {
       if (RawSec->Type != ELF::SHT_PROGBITS || RawSec->Link || RawSec->Info ||
-          RawSec->AddressAlign != 1 || RawSec->Address || RawSec->EntSize)
+          RawSec->AddressAlign != static_cast<llvm::yaml::Hex64>(1) ||
+          RawSec->Address || RawSec->EntSize)
         return true;

       ELFYAML::ELF_SHF ShFlags = RawSec->Flags.getValueOr(ELFYAML::ELF_SHF(0));
@@ -209,7 +210,7 @@
       if (SecName == "debug_str")
         return ShFlags != ELFYAML::ELF_SHF(ELF::SHF_MERGE | ELF::SHF_STRINGS);

-      return ShFlags != 0;
+      return ShFlags != static_cast<llvm::ELFYAML::ELF_SHF>(0);
     }
   }

Index: llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp
===================================================================
--- llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp
+++ llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp
@@ -626,7 +626,7 @@
     unsigned getRegIdx(Register Reg) const {
       for (unsigned Idx = 0; Idx < Locs.size(); ++Idx)
         if (Locs[Idx].Kind == MachineLocKind::RegisterKind &&
-            Locs[Idx].Value.RegNo == Reg)
+            static_cast<llvm::Register>(Locs[Idx].Value.RegNo) == Reg)
           return Idx;
       llvm_unreachable("Could not find given Reg in Locs");
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109534.371678.patch
Type: text/x-patch
Size: 1571 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210909/938a34ea/attachment.bin>


More information about the llvm-commits mailing list