From bcc2b4d7f900249e2fbebeb8c8ad47b24d047513 Mon Sep 17 00:00:00 2001
From: Dmitri Naumov <dmitri.naumov@ufz.de>
Date: Mon, 13 Feb 2017 19:32:30 +0100
Subject: [PATCH] [PL] Fix warnings about side effects evaluation.

warning: expression with side effects will be evaluated despite being used as an operand to 'typeid' [-Wpotentially-evaluated-expression]
---
 ProcessLib/UncoupledProcessesTimeLoop.cpp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/ProcessLib/UncoupledProcessesTimeLoop.cpp b/ProcessLib/UncoupledProcessesTimeLoop.cpp
index ab2301a1e8c..d6b043a727f 100644
--- a/ProcessLib/UncoupledProcessesTimeLoop.cpp
+++ b/ProcessLib/UncoupledProcessesTimeLoop.cpp
@@ -319,12 +319,12 @@ std::vector<std::unique_ptr<SingleProcessData>> createPerProcessData(
                 coupled_process_tree->getConfigParameterList<std::string>(
                     "coupled_process"))
             {
-                auto const& cpl_pcs_ptr = BaseLib::getOrError(
+                auto const& coupled_process = *BaseLib::getOrError(
                     processes, cpl_pcs_name,
                     "A process with the given name has not been defined.");
 
                 auto const inserted = coupled_processes.emplace(
-                    std::type_index(typeid(*cpl_pcs_ptr)), *cpl_pcs_ptr);
+                    std::type_index(typeid(coupled_process)), coupled_process);
                 if (!inserted.second)
                 {  // insertion failed, i.e., key already exists
                     OGS_FATAL("Coupled process `%s' already exists.",
@@ -509,8 +509,9 @@ bool UncoupledProcessesTimeLoop::setCoupledSolutions()
                 _per_process_data.end(),
                 [&coupled_process](
                     std::unique_ptr<SingleProcessData> const& item) {
+                    auto const& item_process = item->process;
                     return std::type_index(typeid(coupled_process)) ==
-                           std::type_index(typeid(item->process));
+                           std::type_index(typeid(item_process));
                 });
 
             if (found_item != _per_process_data.end())
-- 
GitLab