[llvm] 0a4c946 - Fix MSVC warning "all return expressions must deduce to the same type"
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 20 10:58:57 PDT 2022
On Tue, Sep 20, 2022 at 12:17 AM Simon Pilgrim <llvm-dev at redking.me.uk> wrote:
>
> There's a later `return 0ul` that MSVC wouldn't reconcile to a type
> compatible with uintptr_t, but was happy if we provided the explicit
> lambda return type.
Oh, I think this is because 0ul isn't compatible with uintptr_t on
windows ( https://godbolt.org/z/dKGYGqWxj )
Windows uses LLP64 - only `long long` is 64 bits, `long` is only 32 bits.
> On 19/09/2022 22:55, David Blaikie wrote:
> > any idea what problem MSVC actually had?
> >
> > On Mon, Sep 19, 2022 at 8:01 AM Simon Pilgrim via llvm-commits
> > <llvm-commits at lists.llvm.org> wrote:
> >>
> >> Author: Simon Pilgrim
> >> Date: 2022-09-19T16:00:48+01:00
> >> New Revision: 0a4c946abcfaae3601c49a55e29944287f867b7f
> >>
> >> URL: https://github.com/llvm/llvm-project/commit/0a4c946abcfaae3601c49a55e29944287f867b7f
> >> DIFF: https://github.com/llvm/llvm-project/commit/0a4c946abcfaae3601c49a55e29944287f867b7f.diff
> >>
> >> LOG: Fix MSVC warning "all return expressions must deduce to the same type"
> >>
> >> Added:
> >>
> >>
> >> Modified:
> >> llvm/lib/Object/XCOFFObjectFile.cpp
> >>
> >> Removed:
> >>
> >>
> >>
> >> ################################################################################
> >> diff --git a/llvm/lib/Object/XCOFFObjectFile.cpp b/llvm/lib/Object/XCOFFObjectFile.cpp
> >> index b1f44f1db667..853201283bf6 100644
> >> --- a/llvm/lib/Object/XCOFFObjectFile.cpp
> >> +++ b/llvm/lib/Object/XCOFFObjectFile.cpp
> >> @@ -798,7 +798,7 @@ Expected<DataRefImpl> XCOFFObjectFile::getSectionByNum(int16_t Num) const {
> >> DataRefImpl
> >> XCOFFObjectFile::getSectionByType(XCOFF::SectionTypeFlags SectType) const {
> >> DataRefImpl DRI;
> >> - auto GetSectionAddr = [&](const auto &Sections) {
> >> + auto GetSectionAddr = [&](const auto &Sections) -> uintptr_t {
> >> for (const auto &Sec : Sections)
> >> if (Sec.getSectionType() == SectType)
> >> return reinterpret_cast<uintptr_t>(&Sec);
> >>
> >>
> >>
> >> _______________________________________________
> >> llvm-commits mailing list
> >> llvm-commits at lists.llvm.org
> >> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list