This is an archive of the discontinued LLVM Phabricator instance.

fix D78849 for g++ < 7.1
ClosedPublic

Authored by nickdesaulniers on Apr 27 2020, 1:08 PM.

Details

Summary

Looks like g++ < 7.1 has a bug resolving calls to member functions without
this-> in lamdas with auto types. It looks like multiple build bots are
using g++-5.

https://stackoverflow.com/questions/32097759/calling-this-member-function-from-generic-lambda-clang-vs-gcc
https://godbolt.org/z/MiaRt-

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptApr 27 2020, 1:08 PM
nickdesaulniers edited the summary of this revision. (Show Details)Apr 27 2020, 1:12 PM
nickdesaulniers edited the summary of this revision. (Show Details)Apr 27 2020, 1:15 PM
nickdesaulniers retitled this revision from fix D78849 to fix D78849 for g++ < 7.1.
nickdesaulniers edited the summary of this revision. (Show Details)Apr 27 2020, 1:32 PM
nickdesaulniers edited the summary of this revision. (Show Details)Apr 27 2020, 1:39 PM
rsmith accepted this revision.Apr 27 2020, 1:42 PM
This revision is now accepted and ready to land.Apr 27 2020, 1:42 PM
MaskRay added inline comments.Apr 27 2020, 1:45 PM
llvm/lib/CodeGen/MachineVerifier.cpp
172

I think [&](unsigned Reg) { return addRequired(Reg); } works as well...

There might be a this capturing bug in older GCC.

I seem to recall older MSVC has similar bugs.

nickdesaulniers marked 2 inline comments as done.Apr 27 2020, 1:49 PM
llvm/lib/CodeGen/MachineVerifier.cpp
172

Specifically, it's the case below that's problematic. The use of auto is problematic. If I use & capture and spell out the type, it works for g++-5.1, but I think spelling out the type hurts readability, compared to a call through this.

This revision was automatically updated to reflect the committed changes.
nickdesaulniers marked an inline comment as done.