Fix for unused-lambda-capture warning

This is re-land of
https://swiftshader-review.googlesource.com/c/SwiftShader/+/21848

bug: chromium:681136
Change-Id: I11ca3b0f3ccd00ff93cf5eec0e342b49d2ce1f99
Reviewed-on: https://swiftshader-review.googlesource.com/c/22289
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Takuto Ikuta <tikuta@google.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0cf0ffc..1675cf9 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..c92a929 100644
--- a/third_party/subzero/src/IceTargetLowering.h
+++ b/third_party/subzero/src/IceTargetLowering.h
@@ -532,6 +532,7 @@
 
       auto makeExtractThunk = [this, Index, NumElements](Operand *Src) {
         return [this, Index, NumElements, Src]() {
+          (void)NumElements;
           assert(typeNumElements(Src->getType()) == NumElements);
 
           const auto ElementTy = typeElementType(Src->getType());