Fix for unused-lambda-capture warning

We can use const local variables without capturing.

bug: chromium:681136
Change-Id: I2df60e02920841222b6e63aaa2be3ecbb8d6db2c
Reviewed-on: https://swiftshader-review.googlesource.com/c/21848
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Takuto Ikuta <tikuta@google.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fb94ffe..be19aed 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -203,6 +203,7 @@
     set_cpp_flag("-Werror=reorder")
     set_cpp_flag("-Werror=sign-compare")
     set_cpp_flag("-Werror=missing-braces")
+    set_cpp_flag("-Werror=unused-lambda-capture")
     set_cpp_flag("-fno-exceptions")
 
     # Remove xor, and, or and friends from the list of keywords, they are used
diff --git a/third_party/subzero/src/IceTargetLowering.h b/third_party/subzero/src/IceTargetLowering.h
index 5cb42e6..63db6b4 100644
--- a/third_party/subzero/src/IceTargetLowering.h
+++ b/third_party/subzero/src/IceTargetLowering.h
@@ -530,8 +530,8 @@
     for (SizeT I = 0; I < NumElements; ++I) {
       auto *Index = Ctx->getConstantInt32(I);
 
-      auto makeExtractThunk = [this, Index, NumElements](Operand *Src) {
-        return [this, Index, NumElements, Src]() {
+      auto makeExtractThunk = [this, Index](Operand *Src) {
+        return [this, Index, Src]() {
           assert(typeNumElements(Src->getType()) == NumElements);
 
           const auto ElementTy = typeElementType(Src->getType());