[ELF] - LinkerScript: Add workaround for gcc 6.2.0 failure w/auto
authorGeorge Rimar <grimar@accesssoftek.com>
Mon, 19 Sep 2016 13:27:31 +0000 (13:27 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Mon, 19 Sep 2016 13:27:31 +0000 (13:27 +0000)
Will Dietz found and reported that lld does not compile with gcc 6.2.0,
more details https://llvm.org/bugs/show_bug.cgi?id=30438

And confirmed this change fixes the issue.

llvm-svn: 281900

lld/ELF/LinkerScript.cpp

index 6cc932e..7a326c4 100644 (file)
@@ -447,8 +447,8 @@ void LinkerScript<ELFT>::assignOffsets(OutputSectionCommand *Cmd) {
     switchTo(Base);
     Dot += CurOutSec->getSize();
   }
-  for (auto I = E, E = Cmd->Commands.end(); I != E; ++I)
-    process(**I);
+  std::for_each(E, Cmd->Commands.end(),
+                [this](std::unique_ptr<BaseCommand> &B) { process(*B.get()); });
 }
 
 template <class ELFT> void LinkerScript<ELFT>::assignAddresses() {