[llvm] r308599 - [globalisel][tablegen] Fix an issue with lambdas when compiling with older GCC's

Daniel Sanders via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 20 03:25:00 PDT 2017


Author: dsanders
Date: Thu Jul 20 03:25:00 2017
New Revision: 308599

URL: http://llvm.org/viewvc/llvm-project?rev=308599&view=rev
Log:
[globalisel][tablegen] Fix an issue with lambdas when compiling with older GCC's

It seems that G++ 4.8 doesn't accept the 'enum A' in code of the form:
  enum A { ... };
  const auto &F = []() -> enum A { ... };
However, it does accept:
  typedef enum { ... } A;
  const auto &F = []() -> A { ... };


Modified:
    llvm/trunk/include/llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h

Modified: llvm/trunk/include/llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h?rev=308599&r1=308598&r2=308599&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h (original)
+++ llvm/trunk/include/llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h Thu Jul 20 03:25:00 2017
@@ -29,8 +29,8 @@ bool InstructionSelector::executeMatchTa
   uint64_t CurrentIdx = 0;
   SmallVector<uint64_t, 8> OnFailResumeAt;
 
-  enum RejectAction { RejectAndGiveUp, RejectAndResume };
-  auto handleReject = [&]() -> enum RejectAction {
+  typedef enum { RejectAndGiveUp, RejectAndResume } RejectAction;
+  auto handleReject = [&]() -> RejectAction {
     DEBUG(dbgs() << CurrentIdx << ": Rejected\n");
     if (OnFailResumeAt.empty())
       return RejectAndGiveUp;




More information about the llvm-commits mailing list