<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Thu, Jul 20, 2017 at 3:25 AM Daniel Sanders via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: dsanders<br>
Date: Thu Jul 20 03:25:00 2017<br>
New Revision: 308599<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=308599&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=308599&view=rev</a><br>
Log:<br>
[globalisel][tablegen] Fix an issue with lambdas when compiling with older GCC's<br>
<br>
It seems that G++ 4.8 doesn't accept the 'enum A' in code of the form:<br>
  enum A { ... };<br>
  const auto &F = []() -> enum A { ... };<br>
However, it does accept:<br>
  typedef enum { ... } A;<br>
  const auto &F = []() -> A { ... };<br></blockquote><div><br>What if you drop the 'enum' keyword but don't modify the definition of A (leaving it 'enum A { ... }'). The 'typedef enum { ... } A' stuff is generally only needed in C (in C++ you don't need the 'enum' or 'struct' prefix to refer to an enum/struct type, even without the typedef).<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
Modified:<br>
    llvm/trunk/include/llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h<br>
<br>
Modified: llvm/trunk/include/llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h?rev=308599&r1=308598&r2=308599&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h?rev=308599&r1=308598&r2=308599&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h (original)<br>
+++ llvm/trunk/include/llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h Thu Jul 20 03:25:00 2017<br>
@@ -29,8 +29,8 @@ bool InstructionSelector::executeMatchTa<br>
   uint64_t CurrentIdx = 0;<br>
   SmallVector<uint64_t, 8> OnFailResumeAt;<br>
<br>
-  enum RejectAction { RejectAndGiveUp, RejectAndResume };<br>
-  auto handleReject = [&]() -> enum RejectAction {<br>
+  typedef enum { RejectAndGiveUp, RejectAndResume } RejectAction;<br>
+  auto handleReject = [&]() -> RejectAction {<br>
     DEBUG(dbgs() << CurrentIdx << ": Rejected\n");<br>
     if (OnFailResumeAt.empty())<br>
       return RejectAndGiveUp;<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div></div>