Fixed the errors that causes gcc-5.3 to fail.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b97adfa..869d43c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -585,7 +585,7 @@
 set(gtest_force_shared_crt ON CACHE BOOL "Link gtest against shared DLLs on Windows")
 add_subdirectory ("${THIRD_PARTY_SOURCE_DIR}/googletest/googletest"
                   "${CMAKE_CURRENT_BINARY_DIR}/third_party/googletest/googletest")
-include_directories("${THIRD_PARTY_SOURCE_DIR}/googletest/googletest/include")
+include_directories(SYSTEM "${THIRD_PARTY_SOURCE_DIR}/googletest/googletest/include")
 enable_testing()
 
 if (UNIX)
diff --git a/cli/CommandExecutor.cpp b/cli/CommandExecutor.cpp
index e9db628..f38121f 100644
--- a/cli/CommandExecutor.cpp
+++ b/cli/CommandExecutor.cpp
@@ -56,7 +56,7 @@
   // Column width initialized to 6 to take into account the header name
   // and the column value table
   int max_column_width = C::kInitMaxColumnWidth;
-  const CatalogRelation *relation;
+  const CatalogRelation *relation = nullptr;
   if (arguments->size() == 0) {
     for (const CatalogRelation &rel : catalog_database) {
       max_column_width =
diff --git a/expressions/aggregation/AggregationHandleCount.cpp b/expressions/aggregation/AggregationHandleCount.cpp
index 9fb9fd4..5ece8ba 100644
--- a/expressions/aggregation/AggregationHandleCount.cpp
+++ b/expressions/aggregation/AggregationHandleCount.cpp
@@ -112,7 +112,7 @@
   std::size_t count = 0;
   InvokeOnValueAccessorMaybeTupleIdSequenceAdapter(
       accessor,
-      [&](auto *accessor) -> void {  // NOLINT(build/c++11)
+      [&accessor_id, &count](auto *accessor) -> void {  // NOLINT(build/c++11)
     if (nullable_type) {
       while (accessor->next()) {
         count += !accessor->getTypedValue(accessor_id).isNull();
diff --git a/expressions/scalar/ScalarAttribute.cpp b/expressions/scalar/ScalarAttribute.cpp
index 738b1d7..ed91bd1 100644
--- a/expressions/scalar/ScalarAttribute.cpp
+++ b/expressions/scalar/ScalarAttribute.cpp
@@ -92,7 +92,7 @@
   const Type &result_type = attribute_.getType();
   return InvokeOnValueAccessorMaybeTupleIdSequenceAdapter(
       accessor,
-      [&](auto *accessor) -> ColumnVector* {  // NOLINT(build/c++11)
+      [&attr_id, &result_type](auto *accessor) -> ColumnVector* {  // NOLINT(build/c++11)
     if (NativeColumnVector::UsableForType(result_type)) {
       NativeColumnVector *result = new NativeColumnVector(result_type,
                                                           accessor->getNumTuples());
@@ -143,7 +143,10 @@
 
   return InvokeOnValueAccessorNotAdapter(
       accessor,
-      [&](auto *accessor) -> ColumnVector* {  // NOLINT(build/c++11)
+      [&joined_tuple_ids,
+       &attr_id,
+       &result_type,
+       &using_left_relation](auto *accessor) -> ColumnVector* {  // NOLINT(build/c++11)
     if (NativeColumnVector::UsableForType(result_type)) {
       NativeColumnVector *result = new NativeColumnVector(result_type,
                                                           joined_tuple_ids.size());
diff --git a/query_optimizer/ExecutionGenerator.cpp b/query_optimizer/ExecutionGenerator.cpp
index cf90be7..aa46b68 100644
--- a/query_optimizer/ExecutionGenerator.cpp
+++ b/query_optimizer/ExecutionGenerator.cpp
@@ -120,14 +120,14 @@
 DEFINE_string(join_hashtable_type, "SeparateChaining",
               "HashTable implementation to use for hash joins (valid options "
               "are SeparateChaining or LinearOpenAddressing)");
-static const bool join_hashtable_type_dummy
+static const volatile bool join_hashtable_type_dummy
     = gflags::RegisterFlagValidator(&FLAGS_join_hashtable_type,
                                     &ValidateHashTableImplTypeString);
 
 DEFINE_string(aggregate_hashtable_type, "LinearOpenAddressing",
               "HashTable implementation to use for aggregates with GROUP BY "
               "(valid options are SeparateChaining or LinearOpenAddressing)");
-static const bool aggregate_hashtable_type_dummy
+static const volatile bool aggregate_hashtable_type_dummy
     = gflags::RegisterFlagValidator(&FLAGS_aggregate_hashtable_type,
                                     &ValidateHashTableImplTypeString);
 
diff --git a/relational_operators/SortMergeRunOperatorHelpers.cpp b/relational_operators/SortMergeRunOperatorHelpers.cpp
index 1b4332f..4b8c0d9 100644
--- a/relational_operators/SortMergeRunOperatorHelpers.cpp
+++ b/relational_operators/SortMergeRunOperatorHelpers.cpp
@@ -243,7 +243,7 @@
 
   InvokeOnValueAccessorNotAdapter(
       first_accessor,
-      [&](auto *accessor) -> void {  // NOLINT(build/c++11)
+      [this, &attr_id, &comp](auto *accessor) -> void {  // NOLINT(build/c++11)
     typedef typename std::remove_reference<decltype(*accessor)>::type ValueAccessorT;
 
     PtrVector<RunIterator<ValueAccessorT>, true> iterators;
@@ -322,7 +322,7 @@
 
   InvokeOnValueAccessorNotAdapter(
       first_accessor,
-      [&](auto *accessor) -> void {  // NOLINT(build/c++11)
+      [this, &attr_id, &comp](auto *accessor) -> void {  // NOLINT(build/c++11)
     typedef typename std::remove_reference<decltype(*accessor)>::type ValueAccessorT;
 
     PtrVector<RunIterator<ValueAccessorT>> iterators;
diff --git a/relational_operators/TextScanOperator.cpp b/relational_operators/TextScanOperator.cpp
index 4614050..a311a81 100644
--- a/relational_operators/TextScanOperator.cpp
+++ b/relational_operators/TextScanOperator.cpp
@@ -74,7 +74,7 @@
   return true;
 }
 
-static const bool text_scan_split_blob_size_dummy = gflags::RegisterFlagValidator(
+static const volatile bool text_scan_split_blob_size_dummy = gflags::RegisterFlagValidator(
     &FLAGS_textscan_split_blob_size, &ValidateTextScanSplitBlobSize);
 
 namespace {
diff --git a/storage/InsertDestination.cpp b/storage/InsertDestination.cpp
index 30fd2c3..354bed4 100644
--- a/storage/InsertDestination.cpp
+++ b/storage/InsertDestination.cpp
@@ -511,7 +511,10 @@
 
   InvokeOnAnyValueAccessor(
       accessor,
-      [&](auto *accessor) -> void {  // NOLINT(build/c++11)
+      [this,
+       &partition_attribute_id,
+       &always_mark_full,
+       &num_partitions](auto *accessor) -> void {  // NOLINT(build/c++11)
     std::vector<std::unique_ptr<TupleIdSequence>> partition_membership;
     partition_membership.resize(num_partitions);
 
@@ -564,7 +567,11 @@
 
   InvokeOnAnyValueAccessor(
       accessor,
-      [&](auto *accessor) -> void {  // NOLINT(build/c++11)
+      [this,
+       &partition_attribute_id,
+       &attribute_map,
+       &always_mark_full,
+       &num_partitions](auto *accessor) -> void {  // NOLINT(build/c++11)
     std::vector<std::unique_ptr<TupleIdSequence>> partition_membership;
     partition_membership.resize(num_partitions);
 
diff --git a/storage/PackedRowStoreTupleStorageSubBlock.cpp b/storage/PackedRowStoreTupleStorageSubBlock.cpp
index 4cb6d02..ef83a29 100644
--- a/storage/PackedRowStoreTupleStorageSubBlock.cpp
+++ b/storage/PackedRowStoreTupleStorageSubBlock.cpp
@@ -145,7 +145,7 @@
 
   InvokeOnAnyValueAccessor(
       accessor,
-      [&](auto *accessor) -> void {  // NOLINT(build/c++11)
+      [this, &dest_addr, &num_nullable_attrs](auto *accessor) -> void {  // NOLINT(build/c++11)
     const std::size_t num_attrs = relation_.size();
     const std::vector<std::size_t> &attrs_max_size =
         relation_.getMaximumAttributeByteLengths();
@@ -216,7 +216,7 @@
 
   InvokeOnAnyValueAccessor(
       accessor,
-      [&](auto *accessor) -> void {  // NOLINT(build/c++11)
+      [this, &num_nullable_attrs, &attribute_map, &dest_addr](auto *accessor) -> void {  // NOLINT(build/c++11)
     const std::size_t num_attrs = relation_.size();
     const std::vector<std::size_t> &attrs_max_size =
         relation_.getMaximumAttributeByteLengths();
diff --git a/storage/StorageBlock.cpp b/storage/StorageBlock.cpp
index e9ddb70..c2089c1 100644
--- a/storage/StorageBlock.cpp
+++ b/storage/StorageBlock.cpp
@@ -802,7 +802,12 @@
   ValueAccessor *all_accessor = tuple_store_->createValueAccessor(nullptr);
   InvokeOnValueAccessorNotAdapter(
       all_accessor,
-      [&](auto *all_accessor) -> void {  // NOLINT(build/c++11)
+      [&sort_attr_id,
+       &use_input_sequence,
+       &nulls,
+       &refs,
+       &accessor,
+       &sorted_sequence](auto *all_accessor) -> void {  // NOLINT(build/c++11)
     if (use_input_sequence) {
       auto *seq_value_accessor = new OrderedTupleIdSequenceAdapterValueAccessor<
           typename std::remove_reference<decltype(*all_accessor)>::type>(
diff --git a/storage/StorageManager.cpp b/storage/StorageManager.cpp
index 9965dce..1cdbcb6 100644
--- a/storage/StorageManager.cpp
+++ b/storage/StorageManager.cpp
@@ -94,18 +94,18 @@
 }
 DEFINE_int32(block_domain, 1,
              "The unique domain for a distributed Quickstep instance.");
-static const bool block_domain_dummy
+static const volatile bool block_domain_dummy
     = gflags::RegisterFlagValidator(&FLAGS_block_domain, &ValidateBlockDomain);
 
 /**
  * @brief Set or validate the buffer pool slots. When automatically picking a
- *        default value, check if the system is "small" or "large." Set the 
+ *        default value, check if the system is "small" or "large." Set the
  *        buffer pool space to 80% of the installed main memory for small
- *        and 90% otherwise. 
+ *        and 90% otherwise.
  *        This method follows the signature that is set by the gflags module.
- * @param flagname The name of the buffer pool flag. 
+ * @param flagname The name of the buffer pool flag.
  * @param value The value of this flag from the command line, or default (0)
- * @return True if the value was set to a legimate value, false otherwise. 
+ * @return True if the value was set to a legimate value, false otherwise.
  *         Currently this method aims to always find some legitimate value,
  *         and never returns false.
  **/
@@ -149,7 +149,7 @@
               "the buffer pool may temporarily grow larger than this size "
               "if the buffer manager is unable to evict enough unreferenced "
               "blocks to make room for a new allocation.");
-static const bool buffer_pool_slots_dummy
+static const volatile bool buffer_pool_slots_dummy
     = gflags::RegisterFlagValidator(&FLAGS_buffer_pool_slots, &SetOrValidateBufferPoolSlots);
 
 #ifdef QUICKSTEP_HAVE_FILE_MANAGER_HDFS