From 713036eb95285f8dceb12ded9a3cfef81477cb92 Mon Sep 17 00:00:00 2001
From: MichelJuillard <michel.juillard@mjui.fr>
Date: Sun, 13 Nov 2022 10:38:05 +0100
Subject: [PATCH] fix for clang error "local binding used in enclosing
 function"

---
 src/ModelTree.cc | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/ModelTree.cc b/src/ModelTree.cc
index 9f691dcf..be74443b 100644
--- a/src/ModelTree.cc
+++ b/src/ModelTree.cc
@@ -357,6 +357,7 @@ ModelTree::evaluateAndReduceJacobian(const eval_context_t &eval_context) const
   jacob_map_t contemporaneous_jacobian;
   for (const auto &[indices, d1] : derivatives[1])
     {
+      auto &d11 = d1;
       int deriv_id = indices[1];
       if (getTypeByDerivID(deriv_id) == SymbolType::endogenous)
         {
@@ -367,7 +368,7 @@ ModelTree::evaluateAndReduceJacobian(const eval_context_t &eval_context) const
           {
             try
               {
-                return d1->eval(eval_context);
+                return d11->eval(eval_context);
               }
             catch (ExprNode::EvalExternalFunctionException &e)
               {
@@ -1880,10 +1881,11 @@ ModelTree::initializeMEXCompilationWorkers(int numworkers)
       unique_lock<mutex> lk {mex_compilation_mut};
       filesystem::path output;
       string cmd;
-
+  */
       /* Look for an object to compile, whose prerequisites are already
          compiled. If found, remove it from the queue, save the output path and
          the compilation command, and return true. Must be run under the lock. */
+  /*
       auto pick_job = [&cmd, &output]
       {
         for (auto it {mex_compilation_queue.begin()}; it != mex_compilation_queue.end(); ++it)
@@ -1912,10 +1914,14 @@ ModelTree::initializeMEXCompilationWorkers(int numworkers)
             else
               mex_compilation_done.insert(output);
             /* The object just compiled may be a prerequisite for several
+            mex_compilation_done.insert(output);
+  */    
+        /* The object just compiled may be a prerequisite for several
                other objects, so notify all waiting workers. Also needed to
                notify the main thread when in
                ModelTree::waitForMEXCompilationWorkers().*/
-            mex_compilation_cv.notify_all();
+  /*
+  mex_compilation_cv.notify_all();
           }
     });
 */
-- 
GitLab