]> granicus.if.org Git - llvm/commitdiff
[globalisel][tablegen] Fix an issue with lambdas when compiling with older GCC's
authorDaniel Sanders <daniel_l_sanders@apple.com>
Thu, 20 Jul 2017 10:25:00 +0000 (10:25 +0000)
committerDaniel Sanders <daniel_l_sanders@apple.com>
Thu, 20 Jul 2017 10:25:00 +0000 (10:25 +0000)
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 { ... };

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308599 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h

index 5424e4e5ad23893e3862e27373de109210045a38..322ddce22951383c040909c140a0960d51d984a9 100644 (file)
@@ -29,8 +29,8 @@ bool InstructionSelector::executeMatchTable(
   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;