diff --git a/Applications/CLI/ogs.cpp b/Applications/CLI/ogs.cpp
index c3c231dbd2ea32c8a7305557f6baa7646c01e343..462dc8acd37a5159c62f4b3ddf9ad573e84a2a33 100644
--- a/Applications/CLI/ogs.cpp
+++ b/Applications/CLI/ogs.cpp
@@ -202,20 +202,20 @@ int main(int argc, char* argv[])
             BaseLib::setProjectDirectory(
                 BaseLib::extractPath(project_arg.getValue()));
 
-            ProjectData project(*project_config,
+            ProjectData project(project_config,
                                 BaseLib::getProjectDirectory(),
                                 outdir_arg.getValue());
 
             if (!reference_path_arg.isSet())
             {  // Ignore the test_definition section.
-                project_config->ignoreConfigParameter("test_definition");
+                project_config.ignoreConfigParameter("test_definition");
             }
             else
             {
                 test_definition =
                     std::make_unique<ApplicationsLib::TestDefinition>(
                         //! \ogs_file_param{prj__test_definition}
-                        project_config->getConfigSubtree("test_definition"),
+                        project_config.getConfigSubtree("test_definition"),
                         reference_path_arg.getValue(),
                         outdir_arg.getValue());
                 if (test_definition->numberOfTests() == 0)
@@ -240,7 +240,7 @@ int main(int argc, char* argv[])
                 isInsituConfigured = true;
             }
 #else
-            project_config->ignoreConfigParameter("insitu");
+            project_config.ignoreConfigParameter("insitu");
 #endif
 
             INFO("Initialize processes.");
@@ -250,7 +250,7 @@ int main(int argc, char* argv[])
             }
 
             // Check intermediately that config parsing went fine.
-            project_config.checkAndInvalidate();
+            checkAndInvalidate(project_config);
             BaseLib::ConfigTree::assertNoSwallowedErrors();
 
             INFO("Solve processes.");
diff --git a/BaseLib/ConfigTree.cpp b/BaseLib/ConfigTree.cpp
index 28ea0a86e7c78539432eeace28de28c4222e8a5b..9d73c8d3974d5be161ff62c17e1a796df86ca080 100644
--- a/BaseLib/ConfigTree.cpp
+++ b/BaseLib/ConfigTree.cpp
@@ -31,11 +31,12 @@ const char ConfigTree::pathseparator = '/';
 const std::string ConfigTree::key_chars_start = "abcdefghijklmnopqrstuvwxyz";
 const std::string ConfigTree::key_chars = key_chars_start + "_0123456789";
 
-ConfigTree::ConfigTree(PTree const& tree,
+ConfigTree::ConfigTree(ConfigTree::PTree&& top_level_tree,
                        std::string filename,
                        Callback error_cb,
                        Callback warning_cb)
-    : tree_(&tree),
+    : top_level_tree_(std::make_shared<PTree>(std::move(top_level_tree))),
+      tree_(top_level_tree_.get()),
       filename_(std::move(filename)),
       onerror_(std::move(error_cb)),
       onwarning_(std::move(warning_cb))
@@ -52,7 +53,8 @@ ConfigTree::ConfigTree(PTree const& tree,
 
 ConfigTree::ConfigTree(PTree const& tree, ConfigTree const& parent,
                        std::string const& root)
-    : tree_(&tree),
+    : top_level_tree_(parent.top_level_tree_),
+      tree_(&tree),
       path_(joinPaths(parent.path_, root)),
       filename_(parent.filename_),
       onerror_(parent.onerror_),
@@ -62,7 +64,8 @@ ConfigTree::ConfigTree(PTree const& tree, ConfigTree const& parent,
 }
 
 ConfigTree::ConfigTree(ConfigTree&& other)
-    : tree_(other.tree_),
+    : top_level_tree_(std::move(other.top_level_tree_)),
+      tree_(other.tree_),
       path_(std::move(other.path_)),
       filename_(std::move(other.filename_)),
       visited_params_(std::move(other.visited_params_)),
@@ -98,6 +101,7 @@ ConfigTree& ConfigTree::operator=(ConfigTree&& other)
 {
     checkAndInvalidate();
 
+    top_level_tree_ = std::move(other.top_level_tree_);
     tree_ = other.tree_;
     other.tree_ = nullptr;
     path_ = std::move(other.path_);
diff --git a/BaseLib/ConfigTree.h b/BaseLib/ConfigTree.h
index b1e53261ebaa0ad7b7ab265babf727dacdbb23de..9a815bd841349e9a37b94d076cf120e2d283e77d 100644
--- a/BaseLib/ConfigTree.h
+++ b/BaseLib/ConfigTree.h
@@ -254,7 +254,7 @@ public:
     /*!
      * Creates a new instance wrapping the given Boost Property Tree.
      *
-     * \param tree the Boost Property Tree to be wrapped
+     * \param top_level_tree the top level Boost Property Tree
      * \param filename the file from which the \c tree has been read
      * \param error_cb callback function to be called on error.
      * \param warning_cb callback function to be called on warning.
@@ -266,19 +266,11 @@ public:
      * Defaults are strict: By default, both callbacks are set to the same
      * function, i.e., warnings will also result in program abortion!
      */
-    explicit ConfigTree(PTree const& tree,
+    explicit ConfigTree(PTree&& top_level_tree,
                         std::string filename,
                         Callback error_cb,
                         Callback warning_cb);
 
-    /*! This constructor is deleted in order to prevent the user from passing
-     * temporary instances of \c PTree.
-     * Doing so would lead to a dangling reference \c tree_ and to program
-     * crash.
-     */
-    explicit ConfigTree(PTree&&, std::string const&, Callback const&,
-                        Callback const&) = delete;
-
     //! copying is not compatible with the semantics of this class
     ConfigTree(ConfigTree const&) = delete;
 
@@ -637,8 +629,13 @@ private:
     //! returns a short string at suitable for error/warning messages
     static std::string shortString(std::string const& s);
 
+    //! Root of the tree.
+    //!
+    //! Owned by all ConfigTree instances that might access any part of it.
+    std::shared_ptr<PTree const> top_level_tree_;
+
     //! The wrapped tree.
-    boost::property_tree::ptree const* tree_;
+    PTree const* tree_;
 
     //! A path printed in error/warning messages.
     std::string path_;
diff --git a/BaseLib/ConfigTreeUtil.cpp b/BaseLib/ConfigTreeUtil.cpp
index b81526ab871dc4a9fb7c64a3d2a71ab5644c4fb8..954fc5189cb4d2d4332325581524b1ea299236bb 100644
--- a/BaseLib/ConfigTreeUtil.cpp
+++ b/BaseLib/ConfigTreeUtil.cpp
@@ -25,30 +25,6 @@
 
 namespace BaseLib
 {
-ConfigTreeTopLevel::ConfigTreeTopLevel(const std::string& filepath,
-                                       const bool be_ruthless,
-                                       ConfigTree::PTree&& ptree)
-    : ptree_(std::move(ptree)),
-      ctree_(ptree_, filepath, ConfigTree::onerror,
-             be_ruthless ? ConfigTree::onerror : ConfigTree::onwarning)
-{
-}
-
-ConfigTree const& ConfigTreeTopLevel::operator*() const
-{
-    return ctree_;
-}
-
-ConfigTree const* ConfigTreeTopLevel::operator->() const
-{
-    return &ctree_;
-}
-
-void ConfigTreeTopLevel::checkAndInvalidate()
-{
-    ::BaseLib::checkAndInvalidate(ctree_);
-}
-
 // Adapted from
 // https://stackoverflow.com/questions/8154107/how-do-i-merge-update-a-boostproperty-treeptree/8175833
 template <typename T>
@@ -239,10 +215,10 @@ void readAndPatchPrj(std::stringstream& prj_stream, std::string& prj_file,
     }
 }
 
-ConfigTreeTopLevel makeConfigTree(const std::string& filepath,
-                                  const bool be_ruthless,
-                                  const std::string& toplevel_tag,
-                                  const std::vector<std::string>& patch_files)
+ConfigTree makeConfigTree(const std::string& filepath,
+                          const bool be_ruthless,
+                          const std::string& toplevel_tag,
+                          const std::vector<std::string>& patch_files)
 {
     std::string prj_file = filepath;
     std::stringstream prj_stream;
@@ -272,9 +248,12 @@ ConfigTreeTopLevel makeConfigTree(const std::string& filepath,
 
     DBUG("Project configuration from file '{:s}' read.", filepath);
 
-    if (auto child = ptree.get_child_optional(toplevel_tag))
+    if (auto opt_child = ptree.get_child_optional(toplevel_tag))
     {
-        return ConfigTreeTopLevel(filepath, be_ruthless, std::move(*child));
+        auto const callback =
+            be_ruthless ? ConfigTree::onerror : ConfigTree::onwarning;
+
+        return ConfigTree(std::move(*opt_child), filepath, callback, callback);
     }
     OGS_FATAL("Tag <{:s}> has not been found in file `{:s}'.", toplevel_tag,
               filepath);
diff --git a/BaseLib/ConfigTreeUtil.h b/BaseLib/ConfigTreeUtil.h
index c4c1eec78bbca4c2677d42d0d071232b8417ed6d..08d48923e18b84fcfe5b700fd1458159217d121a 100644
--- a/BaseLib/ConfigTreeUtil.h
+++ b/BaseLib/ConfigTreeUtil.h
@@ -11,59 +11,10 @@
 #pragma once
 
 #include "ConfigTree.h"
+#include "Logging.h"
 
 namespace BaseLib
 {
-/*! Manages a ConfigTree and the <tt>boost::property_tree</tt> it depends on.
- *
- * The whole purpose of this class is making the management of said dependency
- * easy.
- */
-class ConfigTreeTopLevel final
-{
-public:
-    /*! Construct a new instance from the given data.
-     *
-     * \param filepath    stored for use in error/warning messages
-     * \param be_ruthless if true, then warnings will raise errors, .i.e. lead
-     *                    to program abortion, else warnings will only warn
-     * \param ptree       the underlying ptree of the created ConfigTree
-     */
-    explicit ConfigTreeTopLevel(std::string const& filepath,
-                                bool const be_ruthless,
-                                ConfigTree::PTree&& ptree);
-
-    /*! Access the contained ConfigTree.
-     *
-     * The non-const version of this method has not been implemented in order to
-     * prevent invalidating the \c ctree_ when it is passed around. In order to
-     * check and invalidate \c ctree_ use the provided member function.
-     */
-    ConfigTree const& operator*() const;
-
-    /*! Access the contained ConfigTree.
-     *
-     * The non-const version of this method has not been implemented in order to
-     * prevent invalidating the \c ctree_ when it is passed around. In order to
-     * check and invalidate \c ctree_ use the provided member function.
-     */
-    ConfigTree const* operator->() const;
-
-    /*! Check if the contained ConfigTree has been processed entirely.
-     *
-     * This only checks the top level, as usual with ConfigTree instances.
-     *
-     * \post Afterwards the contained ConfigTree instance must not be used
-     * anymore!
-     */
-    void checkAndInvalidate();
-
-private:
-    ConfigTree::PTree const
-        ptree_;  //!< <tt>boost::property_tree</tt> that underlies \c ctree_
-    ConfigTree ctree_;  //!< ConfigTree depending on \c ptree_
-};
-
 /*! Create a ConfigTree from an XML file.
  *
  * \param filepath     see ConfigTreeTopLevel::ConfigTreeTopLevel()
@@ -91,10 +42,9 @@ private:
  *
  * \see http://www.boost.org/doc/libs/1_60_0/doc/html/property_tree/parsers.html
  */
-ConfigTreeTopLevel makeConfigTree(
-    std::string const& filepath,
-    bool const be_ruthless,
-    std::string const& toplevel_tag,
-    const std::vector<std::string>& patch_files = {});
+ConfigTree makeConfigTree(std::string const& filepath,
+                          bool const be_ruthless,
+                          std::string const& toplevel_tag,
+                          const std::vector<std::string>& patch_files = {});
 
 }  // namespace BaseLib
diff --git a/GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.cpp b/GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.cpp
index 690f02ab6401932f33384640d228ca488663c306..9ec613610487604b6da5f8dcecc19de6d92d8178 100644
--- a/GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.cpp
+++ b/GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.cpp
@@ -41,19 +41,19 @@ bool BoostXmlGmlInterface::readFile(const std::string& fname)
     auto doc = BaseLib::makeConfigTree(fname, true, "OpenGeoSysGLI");
 
     // ignore attributes related to XML schema
-    doc->ignoreConfigAttribute("xmlns:xsi");
-    doc->ignoreConfigAttribute("xsi:noNamespaceSchemaLocation");
-    doc->ignoreConfigAttribute("xmlns:ogs");
+    doc.ignoreConfigAttribute("xmlns:xsi");
+    doc.ignoreConfigAttribute("xsi:noNamespaceSchemaLocation");
+    doc.ignoreConfigAttribute("xmlns:ogs");
 
     //! \ogs_file_param{gml__name}
-    auto geo_name = doc->getConfigParameter<std::string>("name");
+    auto geo_name = doc.getConfigParameter<std::string>("name");
     if (geo_name.empty())
     {
         OGS_FATAL("BoostXmlGmlInterface::readFile(): <name> tag is empty.");
     }
 
     //! \ogs_file_param{gml__points}
-    for (auto st : doc->getConfigSubtreeList("points"))
+    for (auto st : doc.getConfigSubtreeList("points"))
     {
         std::vector<GeoLib::Point*> points;
         GeoLib::PointVec::NameIdMap pnt_names;
@@ -65,7 +65,7 @@ bool BoostXmlGmlInterface::readFile(const std::string& fname)
     std::vector<GeoLib::Polyline*> polylines;
     GeoLib::PolylineVec::NameIdMap ply_names;
     //! \ogs_file_param{gml__polylines}
-    for (auto st : doc->getConfigSubtreeList("polylines"))
+    for (auto st : doc.getConfigSubtreeList("polylines"))
     {
         readPolylines(st,
                       polylines,
@@ -78,7 +78,7 @@ bool BoostXmlGmlInterface::readFile(const std::string& fname)
     SurfaceVec::NameIdMap sfc_names;
 
     //! \ogs_file_param{gml__surfaces}
-    for (auto st : doc->getConfigSubtreeList("surfaces"))
+    for (auto st : doc.getConfigSubtreeList("surfaces"))
     {
         readSurfaces(st, surfaces, *_geo_objects.getPointVec(geo_name),
                      _geo_objects.getPointVecObj(geo_name)->getIDMap(),
diff --git a/Tests/BaseLib/TestConfigTree.cpp b/Tests/BaseLib/TestConfigTree.cpp
index cb84a19a26680710ce7b82ae3173a206cc371427..5964d36aab8b7917df0a42865486a6866ae5210c 100644
--- a/Tests/BaseLib/TestConfigTree.cpp
+++ b/Tests/BaseLib/TestConfigTree.cpp
@@ -90,10 +90,10 @@ private:
     bool _warning = false;
 };
 
-BaseLib::ConfigTree makeConfigTree(boost::property_tree::ptree const& ptree,
+BaseLib::ConfigTree makeConfigTree(boost::property_tree::ptree&& ptree,
                                    Callbacks& cbs)
 {
-    return BaseLib::ConfigTree(ptree, "FILENAME", cbs.get_error_cb(),
+    return BaseLib::ConfigTree(std::move(ptree), "FILENAME", cbs.get_error_cb(),
                                cbs.get_warning_cb());
 }
 
@@ -103,7 +103,7 @@ TEST(BaseLibConfigTree, Empty)
     Callbacks cbs;
 
     {
-        auto const conf = makeConfigTree(ptree, cbs);
+        auto const conf = makeConfigTree(std::move(ptree), cbs);
         (void)conf;
     }  // ConfigTree destroyed here
 
@@ -131,11 +131,11 @@ TEST(BaseLibConfigTree, Get)
         "<vector>0 1 2 3 4</vector>"
         "<vector_bad1>x 1 2a</vector_bad1>"
         "<vector_bad2>0 1 2a</vector_bad2>";
-    auto const ptree = Tests::readXml(xml);
+    auto ptree = Tests::readXml(xml);
 
     Callbacks cbs;
     {
-        auto const conf = makeConfigTree(ptree, cbs);
+        auto const conf = makeConfigTree(std::move(ptree), cbs);
 
         EXPECT_EQ(5.6e-4, conf.getConfigParameter<double>(
                               "double"));  // read certain types
@@ -277,11 +277,11 @@ TEST(BaseLibConfigTree, IncompleteParse)
         "<tag>this data won't be read</tag>"
         "<pt x=\"0.5\">1</pt>"
         "<pt2 x=\"0.5\" y=\"1.0\" z=\"2.0\" />";
-    auto const ptree = Tests::readXml(xml);
+    auto ptree = Tests::readXml(xml);
 
     Callbacks cbs;
     {
-        auto const conf = makeConfigTree(ptree, cbs);
+        auto const conf = makeConfigTree(std::move(ptree), cbs);
 
         EXPECT_EQ(5.6, conf.getConfigParameter<double>("double"));
         EXPECT_ERR_WARN(cbs, false, false);
@@ -318,11 +318,11 @@ TEST(BaseLibConfigTree, CheckRange)
         "<int>0</int>"
         "<int>1</int>"
         "<int>2</int>";
-    auto const ptree = Tests::readXml(xml);
+    auto ptree = Tests::readXml(xml);
 
     Callbacks cbs;
     {
-        auto const conf = makeConfigTree(ptree, cbs);
+        auto const conf = makeConfigTree(std::move(ptree), cbs);
 
         {
             // check that std::distance can be computed twice in a row
@@ -356,11 +356,11 @@ TEST(BaseLibConfigTree, GetSubtreeList)
         "<val><int>0</int></val>"
         "<val><int>1</int></val>"
         "<val><int>2</int></val>";
-    auto const ptree = Tests::readXml(xml);
+    auto ptree = Tests::readXml(xml);
 
     Callbacks cbs;
     {
-        auto const conf = makeConfigTree(ptree, cbs);
+        auto const conf = makeConfigTree(std::move(ptree), cbs);
 
         auto const expected_empty_list =
             conf.getConfigParameterList("nonexistent_list");
@@ -387,11 +387,11 @@ TEST(BaseLibConfigTree, GetParamList)
         "<int>2</int>"
         "<int2 a=\"b\">3</int2>"
         "<int3>4<error/></int3>";
-    auto const ptree = Tests::readXml(xml);
+    auto ptree = Tests::readXml(xml);
 
     Callbacks cbs;
     {
-        auto const conf = makeConfigTree(ptree, cbs);
+        auto const conf = makeConfigTree(std::move(ptree), cbs);
 
         auto const expected_empty_list =
             conf.getConfigParameterList("nonexistent_list");
@@ -436,11 +436,11 @@ TEST(BaseLibConfigTree, GetValueList)
         "<int>0</int>"
         "<int>1</int>"
         "<int>2</int>";
-    auto const ptree = Tests::readXml(xml);
+    auto ptree = Tests::readXml(xml);
 
     Callbacks cbs;
     {
-        auto const conf = makeConfigTree(ptree, cbs);
+        auto const conf = makeConfigTree(std::move(ptree), cbs);
 
         auto const expected_empty_list =
             conf.getConfigParameterList<int>("nonexistent_list");
@@ -468,11 +468,11 @@ TEST(BaseLibConfigTree, NoConversion)
         "<bool>true</bool>"
         "<ign/>"
         "<ign2/><ign2/><ign2/>";
-    auto const ptree = Tests::readXml(xml);
+    auto ptree = Tests::readXml(xml);
 
     Callbacks cbs;
     {
-        auto const conf = makeConfigTree(ptree, cbs);
+        auto const conf = makeConfigTree(std::move(ptree), cbs);
 
         EXPECT_ANY_THROW(conf.getConfigParameter<int>("int"));
         EXPECT_ERR_WARN(cbs, true, false);
@@ -519,11 +519,11 @@ TEST(BaseLibConfigTree, NoConversion)
 TEST(BaseLibConfigTree, BadKeynames)
 {
     const char xml[] = "";
-    auto const ptree = Tests::readXml(xml);
+    auto ptree = Tests::readXml(xml);
 
     Callbacks cbs;
     {
-        auto const conf = makeConfigTree(ptree, cbs);
+        auto const conf = makeConfigTree(std::move(ptree), cbs);
 
         for (auto tag : {"<", "Z", ".", "$", "0", "", "/", "_", "a__"})
         {
@@ -563,11 +563,11 @@ TEST(BaseLibConfigTree, StringLiterals)
     const char xml[] =
         "<s>test</s>"
         "<t>Test</t>";
-    auto const ptree = Tests::readXml(xml);
+    auto ptree = Tests::readXml(xml);
 
     Callbacks cbs;
     {
-        auto const conf = makeConfigTree(ptree, cbs);
+        auto const conf = makeConfigTree(std::move(ptree), cbs);
 
         EXPECT_EQ("test", conf.getConfigParameter<std::string>("s", "XX"));
         EXPECT_ERR_WARN(cbs, false, false);
@@ -589,11 +589,11 @@ TEST(BaseLibConfigTree, MoveConstruct)
         "<s>test</s>"
         "<t>Test</t>"
         "<u>data</u>";
-    auto const ptree = Tests::readXml(xml);
+    auto ptree = Tests::readXml(xml);
 
     Callbacks cbs;
     {
-        auto conf = makeConfigTree(ptree, cbs);
+        auto conf = makeConfigTree(std::move(ptree), cbs);
 
         EXPECT_EQ("test", conf.getConfigParameter<std::string>("s", "XX"));
         EXPECT_ERR_WARN(cbs, false, false);
@@ -637,7 +637,7 @@ TEST(BaseLibConfigTree, MoveAssign)
 
     Callbacks cbs;
     {
-        auto conf = makeConfigTree(ptree, cbs);
+        auto conf = makeConfigTree(boost::property_tree::ptree(ptree), cbs);
 
         EXPECT_EQ("test", conf.getConfigParameter<std::string>("s", "XX"));
         EXPECT_ERR_WARN(cbs, false, false);
@@ -650,7 +650,7 @@ TEST(BaseLibConfigTree, MoveAssign)
 
         // test that read status of data is transferred in move assignment
         {
-            auto u2 = makeConfigTree(ptree, cbs);
+            auto u2 = makeConfigTree(boost::property_tree::ptree(ptree), cbs);
             u2 = std::move(u);
             // Expect warning because u2 has not been traversed
             // entirely before assignment.
@@ -660,7 +660,8 @@ TEST(BaseLibConfigTree, MoveAssign)
 
         // test that read status of children is transferred in move construction
         {
-            auto conf2 = makeConfigTree(ptree, cbs);
+            auto conf2 =
+                makeConfigTree(boost::property_tree::ptree(ptree), cbs);
             conf2 = std::move(conf);
             // Expect warning because conf2 has not been traversed
             // entirely before assignment.
@@ -676,3 +677,34 @@ TEST(BaseLibConfigTree, MoveAssign)
     }  // ConfigTree destroyed here
     EXPECT_ERR_WARN(cbs, false, false);
 }
+
+TEST(BaseLibConfigTree, ChildLivesOnIfParentDies)
+{
+    const char xml[] =
+        "<s>test</s>"
+        "<t>Test</t>"
+        "<u>data</u>";
+    auto ptree = Tests::readXml(xml);
+
+    Callbacks cbs;
+
+    {
+        std::optional<BaseLib::ConfigTree> opt_child;
+
+        {
+            auto const parent = makeConfigTree(std::move(ptree), cbs);
+            opt_child = parent.getConfigSubtree("s");
+
+            // do something with parent after subtree access
+            EXPECT_EQ("Test", parent.getConfigParameter<std::string>("t"));
+        }  // parent goes out of scope
+
+        EXPECT_ERR_WARN(cbs, false,
+                        true);  // warning because <u> has not been read.
+
+        // do something with the child
+        EXPECT_EQ("test", opt_child->getValue<std::string>());
+    }
+
+    EXPECT_ERR_WARN(cbs, false, false);
+}
diff --git a/Tests/MaterialLib/TestCapillaryPressureSaturationModel.cpp b/Tests/MaterialLib/TestCapillaryPressureSaturationModel.cpp
index 51b3e58e808e2f7c84270c6f6806ac7c02fb1fd0..4ee5286e7675789171e0c086a38e01c7cd41fad3 100644
--- a/Tests/MaterialLib/TestCapillaryPressureSaturationModel.cpp
+++ b/Tests/MaterialLib/TestCapillaryPressureSaturationModel.cpp
@@ -26,8 +26,8 @@ using namespace MaterialLib::PorousMedium;
 std::unique_ptr<CapillaryPressureSaturation> createCapillaryPressureModel(
     const char xml[])
 {
-    auto const ptree = Tests::readXml(xml);
-    BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror,
+    auto ptree = Tests::readXml(xml);
+    BaseLib::ConfigTree conf(std::move(ptree), "", BaseLib::ConfigTree::onerror,
                              BaseLib::ConfigTree::onwarning);
     auto const& sub_config = conf.getConfigSubtree("capillary_pressure");
     return MaterialLib::PorousMedium::createCapillaryPressureModel(sub_config);
diff --git a/Tests/MaterialLib/TestFluidDensity.cpp b/Tests/MaterialLib/TestFluidDensity.cpp
index 9449651bd3a9486242abe7d9547b958abfd07f48..29d35b63783622571e5c56337f56f61d4e7f7194 100644
--- a/Tests/MaterialLib/TestFluidDensity.cpp
+++ b/Tests/MaterialLib/TestFluidDensity.cpp
@@ -27,8 +27,8 @@ using ArrayType = MaterialLib::Fluid::FluidProperty::ArrayType;
 // Test density models.
 std::unique_ptr<FluidProperty> createTestFluidDensityModel(const char xml[])
 {
-    auto const ptree = Tests::readXml(xml);
-    BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror,
+    auto ptree = Tests::readXml(xml);
+    BaseLib::ConfigTree conf(std::move(ptree), "", BaseLib::ConfigTree::onerror,
                              BaseLib::ConfigTree::onwarning);
     auto const& sub_config = conf.getConfigSubtree("density");
     return MaterialLib::Fluid::createFluidDensityModel(sub_config);
diff --git a/Tests/MaterialLib/TestFluidProperties.cpp b/Tests/MaterialLib/TestFluidProperties.cpp
index a85d9baa105c2c0c438836043a9d9fd63635f50d..f365f7665e0c3168a76be0b0a3f797f68540f244 100644
--- a/Tests/MaterialLib/TestFluidProperties.cpp
+++ b/Tests/MaterialLib/TestFluidProperties.cpp
@@ -28,8 +28,8 @@ using ArrayType = MaterialLib::Fluid::FluidProperty::ArrayType;
 
 std::unique_ptr<FluidProperties> createTestFluidProperties(const char xml[])
 {
-    auto const ptree = Tests::readXml(xml);
-    BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror,
+    auto ptree = Tests::readXml(xml);
+    BaseLib::ConfigTree conf(std::move(ptree), "", BaseLib::ConfigTree::onerror,
                              BaseLib::ConfigTree::onwarning);
     auto const& sub_config = conf.getConfigSubtree("fluid");
     return createFluidProperties(sub_config);
diff --git a/Tests/MaterialLib/TestFluidSpecificHeatCapacityModel.cpp b/Tests/MaterialLib/TestFluidSpecificHeatCapacityModel.cpp
index d6ae3383010f84dfbf8896d88a41207db749f995..bc5ca17327fdbb8d9184ff73999a673f4ee813ca 100644
--- a/Tests/MaterialLib/TestFluidSpecificHeatCapacityModel.cpp
+++ b/Tests/MaterialLib/TestFluidSpecificHeatCapacityModel.cpp
@@ -28,8 +28,8 @@ using ArrayType = MaterialLib::Fluid::FluidProperty::ArrayType;
 std::unique_ptr<FluidProperty> createSpecificFluidHeatCapacityModel(
     const char xml[])
 {
-    auto const ptree = Tests::readXml(xml);
-    BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror,
+    auto ptree = Tests::readXml(xml);
+    BaseLib::ConfigTree conf(std::move(ptree), "", BaseLib::ConfigTree::onerror,
                              BaseLib::ConfigTree::onwarning);
     auto const& sub_config = conf.getConfigSubtree("specific_heat_capacity");
     return createSpecificFluidHeatCapacityModel(sub_config);
diff --git a/Tests/MaterialLib/TestFluidThermalConductivityModel.cpp b/Tests/MaterialLib/TestFluidThermalConductivityModel.cpp
index 22dddcada9cb58ad99aaf81a3feb132825f5f30e..c4f900db3bfe9dd6a68096a770febca0ac03f278 100644
--- a/Tests/MaterialLib/TestFluidThermalConductivityModel.cpp
+++ b/Tests/MaterialLib/TestFluidThermalConductivityModel.cpp
@@ -29,8 +29,8 @@ using ArrayType = MaterialLib::Fluid::FluidProperty::ArrayType;
 std::unique_ptr<FluidProperty> createFluidThermalConductivityModel(
     const char xml[])
 {
-    auto const ptree = Tests::readXml(xml);
-    BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror,
+    auto ptree = Tests::readXml(xml);
+    BaseLib::ConfigTree conf(std::move(ptree), "", BaseLib::ConfigTree::onerror,
                              BaseLib::ConfigTree::onwarning);
     auto const& sub_config = conf.getConfigSubtree("thermal_conductivity");
     return createFluidThermalConductivityModel(sub_config);
diff --git a/Tests/MaterialLib/TestFluidViscosity.cpp b/Tests/MaterialLib/TestFluidViscosity.cpp
index 91e1cf8bcb565cbae0aa1190b9fa7e1e5f0bde00..e0b90853d594dffe03e7b794a2494330d0e3fefc 100644
--- a/Tests/MaterialLib/TestFluidViscosity.cpp
+++ b/Tests/MaterialLib/TestFluidViscosity.cpp
@@ -26,8 +26,8 @@ using ArrayType = MaterialLib::Fluid::FluidProperty::ArrayType;
 
 std::unique_ptr<FluidProperty> createTestViscosityModel(const char xml[])
 {
-    auto const ptree = Tests::readXml(xml);
-    BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror,
+    auto ptree = Tests::readXml(xml);
+    BaseLib::ConfigTree conf(std::move(ptree), "", BaseLib::ConfigTree::onerror,
                              BaseLib::ConfigTree::onwarning);
     auto const& sub_config = conf.getConfigSubtree("viscosity");
     return MaterialLib::Fluid::createViscosityModel(sub_config);
diff --git a/Tests/MaterialLib/TestMPL.cpp b/Tests/MaterialLib/TestMPL.cpp
index e414e63bcb6003fa09635726bec129ffb164d94d..b6f196b5c61af29a9edd259beb65e83fb63c787d 100644
--- a/Tests/MaterialLib/TestMPL.cpp
+++ b/Tests/MaterialLib/TestMPL.cpp
@@ -29,8 +29,8 @@ std::unique_ptr<MPL::Medium> createTestMaterial(
     std::string const& xml, int const geometry_dimension,
     ParameterLib::CoordinateSystem const* const local_coordinate_system)
 {
-    auto const ptree = Tests::readXml(xml.c_str());
-    BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror,
+    auto ptree = Tests::readXml(xml.c_str());
+    BaseLib::ConfigTree conf(std::move(ptree), "", BaseLib::ConfigTree::onerror,
                              BaseLib::ConfigTree::onwarning);
     auto const& config = conf.getConfigSubtree("medium");
     std::vector<std::unique_ptr<ParameterLib::ParameterBase>> parameters;
@@ -48,8 +48,8 @@ std::unique_ptr<MaterialPropertyLib::Property> createTestProperty(
         BaseLib::ConfigTree const& config)>
         createProperty)
 {
-    auto const ptree = Tests::readXml(xml);
-    BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror,
+    auto ptree = Tests::readXml(xml);
+    BaseLib::ConfigTree conf(std::move(ptree), "", BaseLib::ConfigTree::onerror,
                              BaseLib::ConfigTree::onwarning);
     auto const& sub_config = conf.getConfigSubtree("property");
     // Parsing the property name:
diff --git a/Tests/MaterialLib/TestMPLLinearSaturationSwellingStress.cpp b/Tests/MaterialLib/TestMPLLinearSaturationSwellingStress.cpp
index adcc2f17fae7ee6d41c95bbba06d042d6cd7cde4..30046e473d789d1e93177c197e9fec9d9e97e400 100644
--- a/Tests/MaterialLib/TestMPLLinearSaturationSwellingStress.cpp
+++ b/Tests/MaterialLib/TestMPLLinearSaturationSwellingStress.cpp
@@ -19,8 +19,8 @@
 std::unique_ptr<MaterialPropertyLib::Property>
 createLinearSaturationSwellingStressModel(const char xml[])
 {
-    auto const ptree = Tests::readXml(xml);
-    BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror,
+    auto ptree = Tests::readXml(xml);
+    BaseLib::ConfigTree conf(std::move(ptree), "", BaseLib::ConfigTree::onerror,
                              BaseLib::ConfigTree::onwarning);
     auto const& sub_config = conf.getConfigSubtree("property");
     return MaterialPropertyLib::createLinearSaturationSwellingStress(
diff --git a/Tests/MaterialLib/TestMPLSoilThermalConductivitySomerton.cpp b/Tests/MaterialLib/TestMPLSoilThermalConductivitySomerton.cpp
index 2f9e9d15a6efec5d6d3c3b88743c3e73b8d234e9..81b42073bae31cd1a5599f4af8b0843f9654e327 100644
--- a/Tests/MaterialLib/TestMPLSoilThermalConductivitySomerton.cpp
+++ b/Tests/MaterialLib/TestMPLSoilThermalConductivitySomerton.cpp
@@ -42,8 +42,8 @@ createTestSoilThermalConductivitySomertonProperty(
         ParameterLib::CoordinateSystem const* const local_coordinate_system)>
         createProperty)
 {
-    auto const ptree = Tests::readXml(xml);
-    BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror,
+    auto ptree = Tests::readXml(xml);
+    BaseLib::ConfigTree conf(std::move(ptree), "", BaseLib::ConfigTree::onerror,
                              BaseLib::ConfigTree::onwarning);
     auto const& sub_config = conf.getConfigSubtree("property");
     // Parsing the property name:
diff --git a/Tests/MaterialLib/TestPorousMediumStorage.cpp b/Tests/MaterialLib/TestPorousMediumStorage.cpp
index 9af8efaa0af3e673dfdc54a55da8208524b12b5f..a7c8e1254512d4ba54dd42444b795afe0f342892 100644
--- a/Tests/MaterialLib/TestPorousMediumStorage.cpp
+++ b/Tests/MaterialLib/TestPorousMediumStorage.cpp
@@ -23,8 +23,8 @@ using namespace MaterialLib::PorousMedium;
 
 std::unique_ptr<Storage> createTestStorageModel(const char xml[])
 {
-    auto const ptree = Tests::readXml(xml);
-    BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror,
+    auto ptree = Tests::readXml(xml);
+    BaseLib::ConfigTree conf(std::move(ptree), "", BaseLib::ConfigTree::onerror,
                              BaseLib::ConfigTree::onwarning);
     auto const& sub_config = conf.getConfigSubtree("storage");
     return MaterialLib::PorousMedium::createStorageModel(sub_config);
diff --git a/Tests/MaterialLib/TestRelativePermeabilityModel.cpp b/Tests/MaterialLib/TestRelativePermeabilityModel.cpp
index 3d5835e5f850c9f4cf2fbd8935717d63e0dcfbf4..e739cce923e49ae984b7cc739e73d23aa770ae08 100644
--- a/Tests/MaterialLib/TestRelativePermeabilityModel.cpp
+++ b/Tests/MaterialLib/TestRelativePermeabilityModel.cpp
@@ -26,8 +26,8 @@ using namespace MaterialLib::PorousMedium;
 std::unique_ptr<RelativePermeability> createRelativePermeabilityModel(
     const char xml[])
 {
-    auto const ptree = Tests::readXml(xml);
-    BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror,
+    auto ptree = Tests::readXml(xml);
+    BaseLib::ConfigTree conf(std::move(ptree), "", BaseLib::ConfigTree::onerror,
                              BaseLib::ConfigTree::onwarning);
     auto const& sub_config = conf.getConfigSubtree("relative_permeability");
     sub_config.ignoreConfigAttribute("id");
diff --git a/Tests/MathLib/TestLinearSolver.cpp b/Tests/MathLib/TestLinearSolver.cpp
index 12d2142a0e3ae881d307278217e906beef0492ed..f1e909315cf425d1b190a6935f85bc47206ff158 100644
--- a/Tests/MathLib/TestLinearSolver.cpp
+++ b/Tests/MathLib/TestLinearSolver.cpp
@@ -305,7 +305,8 @@ TEST(Math, CheckInterface_Eigen)
     t_solver.put("error_tolerance", 1e-15);
     t_solver.put("max_iteration_step", 1000);
     t_root.put_child("eigen", t_solver);
-    BaseLib::ConfigTree conf(t_root, "", BaseLib::ConfigTree::onerror,
+    BaseLib::ConfigTree conf(std::move(t_root), "",
+                             BaseLib::ConfigTree::onerror,
                              BaseLib::ConfigTree::onwarning);
 
     using IntType = MathLib::EigenMatrix::IndexType;
@@ -322,7 +323,8 @@ TEST(Math, CheckInterface_EigenLis)
     // set solver options using Boost property tree
     boost::property_tree::ptree t_root;
     t_root.put("lis", "-i cg -p none -tol 1e-15 -maxiter 1000");
-    BaseLib::ConfigTree conf(t_root, "", BaseLib::ConfigTree::onerror,
+    BaseLib::ConfigTree conf(std::move(t_root), "",
+                             BaseLib::ConfigTree::onerror,
                              BaseLib::ConfigTree::onwarning);
 
     using IntType = MathLib::EigenMatrix::IndexType;
@@ -362,7 +364,8 @@ TEST(MPITest_Math, CheckInterface_PETSc_Linear_Solver_basic)
     checkLinearSolverInterface<MathLib::PETScMatrix, MathLib::PETScVector,
                                MathLib::PETScLinearSolver>(
         A, b, "",
-        BaseLib::ConfigTree(petsc_solver, "", BaseLib::ConfigTree::onerror,
+        BaseLib::ConfigTree(std::move(petsc_solver), "",
+                            BaseLib::ConfigTree::onerror,
                             BaseLib::ConfigTree::onwarning));
 }
 
@@ -393,7 +396,8 @@ TEST(MPITest_Math, CheckInterface_PETSc_Linear_Solver_chebyshev_sor)
     checkLinearSolverInterface<MathLib::PETScMatrix, MathLib::PETScVector,
                                MathLib::PETScLinearSolver>(
         A, b, "",
-        BaseLib::ConfigTree(petsc_solver, "", BaseLib::ConfigTree::onerror,
+        BaseLib::ConfigTree(std::move(petsc_solver), "",
+                            BaseLib::ConfigTree::onerror,
                             BaseLib::ConfigTree::onwarning));
 }
 
@@ -427,7 +431,8 @@ TEST(MPITest_Math, CheckInterface_PETSc_Linear_Solver_gmres_amg)
     checkLinearSolverInterface<MathLib::PETScMatrix, MathLib::PETScVector,
                                MathLib::PETScLinearSolver>(
         A, b, "",
-        BaseLib::ConfigTree(petsc_solver, "", BaseLib::ConfigTree::onerror,
+        BaseLib::ConfigTree(std::move(petsc_solver), "",
+                            BaseLib::ConfigTree::onerror,
                             BaseLib::ConfigTree::onwarning));
 }
 
diff --git a/Tests/MathLib/TestODESolver.cpp b/Tests/MathLib/TestODESolver.cpp
index ce055aebdbb632ed853f86daadff055e0c9fa9e9..8e35e2f7f524d3c957eb96adc90059a3b2e77aa9 100644
--- a/Tests/MathLib/TestODESolver.cpp
+++ b/Tests/MathLib/TestODESolver.cpp
@@ -75,7 +75,7 @@ bool any_ode_solver_libs_available()
 
 template <unsigned NumEquations>
 std::unique_ptr<MathLib::ODE::ODESolver<NumEquations>> make_ode_solver(
-    boost::property_tree::ptree const& conf)
+    boost::property_tree::ptree&& conf)
 {
     // Make sure testrunner does not crash if we haven't built with support for
     // any external ODE solver lib.
@@ -86,7 +86,8 @@ std::unique_ptr<MathLib::ODE::ODESolver<NumEquations>> make_ode_solver(
         return nullptr;
     }
 
-    BaseLib::ConfigTree config(conf, "", BaseLib::ConfigTree::onerror,
+    BaseLib::ConfigTree config(std::move(conf), "",
+                               BaseLib::ConfigTree::onerror,
                                BaseLib::ConfigTree::onwarning);
     return MathLib::ODE::createODESolver<NumEquations>(config);
 }
@@ -129,7 +130,7 @@ TEST(MathLibCVodeTest, Exponential)
     const double t0 = 0.0;
 
     auto tree = boost::property_tree::ptree{};
-    auto ode_solver = make_ode_solver<1>(tree);
+    auto ode_solver = make_ode_solver<1>(std::move(tree));
 
     ASSERT_EQ(any_ode_solver_libs_available(), !!ode_solver);
     // Don't run the test if the ODE solver could not be constructed.
@@ -171,7 +172,7 @@ TEST(MathLibCVodeTest, ExponentialExtraData)
     const double t0 = 0.0;
 
     auto tree = boost::property_tree::ptree{};
-    auto ode_solver = make_ode_solver<1>(tree);
+    auto ode_solver = make_ode_solver<1>(std::move(tree));
 
     ASSERT_EQ(any_ode_solver_libs_available(), !!ode_solver);
     // Don't run the test if the ODE solver could not be constructed.
@@ -236,7 +237,7 @@ TEST(MathLibCVodeTest, ExponentialWithJacobian)
     const double t0 = 0.0;
 
     auto tree = boost::property_tree::ptree{};
-    auto ode_solver = make_ode_solver<1>(tree);
+    auto ode_solver = make_ode_solver<1>(std::move(tree));
 
     ASSERT_EQ(any_ode_solver_libs_available(), !!ode_solver);
     // Don't run the test if the ODE solver could not be constructed.
@@ -280,7 +281,7 @@ TEST(MathLibCVodeTest, ExponentialWithJacobianNewton)
     boost::property_tree::ptree tree;
     tree.put("linear_multistep_method", "BDF");
     tree.put("nonlinear_solver_iteration", "Newton");
-    auto ode_solver = make_ode_solver<1>(tree);
+    auto ode_solver = make_ode_solver<1>(std::move(tree));
 
     ASSERT_EQ(any_ode_solver_libs_available(), !!ode_solver);
     // Don't run the test if the ODE solver could not be constructed.
diff --git a/Tests/MathLib/TestPiecewiseLinearCurve.cpp b/Tests/MathLib/TestPiecewiseLinearCurve.cpp
index 7cdbab29d4c8b3fa0c4c6576316c339371cde4c1..4199d6cb45c17466357b6e5334b5959f06418c11 100644
--- a/Tests/MathLib/TestPiecewiseLinearCurve.cpp
+++ b/Tests/MathLib/TestPiecewiseLinearCurve.cpp
@@ -23,8 +23,8 @@
 template <typename CurveType>
 std::unique_ptr<CurveType> createPiecewiseLinearCurve(const char xml[])
 {
-    auto const ptree = Tests::readXml(xml);
-    BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror,
+    auto ptree = Tests::readXml(xml);
+    BaseLib::ConfigTree conf(std::move(ptree), "", BaseLib::ConfigTree::onerror,
                              BaseLib::ConfigTree::onwarning);
     auto const& sub_config = conf.getConfigSubtree("curve");
     return MathLib::createPiecewiseLinearCurve<CurveType>(sub_config);
diff --git a/Tests/NumLib/TestSerialLinearSolver.cpp b/Tests/NumLib/TestSerialLinearSolver.cpp
index fd376d760c38fcf614ceccfa51fdfd3c03d29e3b..33f5c36039fabd9458f2ca5fabd81393ab36fcc1 100644
--- a/Tests/NumLib/TestSerialLinearSolver.cpp
+++ b/Tests/NumLib/TestSerialLinearSolver.cpp
@@ -125,7 +125,8 @@ TEST(NumLibSerialLinearSolver, Steady2DdiffusionQuadElem)
         t_root.put_child("eigen", t_solver);
     }
     t_root.put("lis", "-i cg -p none -tol 1e-16 -maxiter 1000");
-    BaseLib::ConfigTree conf(t_root, "", BaseLib::ConfigTree::onerror,
+    BaseLib::ConfigTree conf(std::move(t_root), "",
+                             BaseLib::ConfigTree::onerror,
                              BaseLib::ConfigTree::onwarning);
 
     auto const linear_solver_parser =
diff --git a/Tests/NumLib/TestTimeSteppingEvolutionaryPIDcontroller.cpp b/Tests/NumLib/TestTimeSteppingEvolutionaryPIDcontroller.cpp
index da5a03b708351f6d090803e8e06ce9c69991f853..8d07e97898cc06fa63f1bb15189025e07793d700 100644
--- a/Tests/NumLib/TestTimeSteppingEvolutionaryPIDcontroller.cpp
+++ b/Tests/NumLib/TestTimeSteppingEvolutionaryPIDcontroller.cpp
@@ -23,8 +23,8 @@
 std::unique_ptr<NumLib::TimeStepAlgorithm> createTestTimeStepper(
     const char xml[])
 {
-    auto const ptree = Tests::readXml(xml);
-    BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror,
+    auto ptree = Tests::readXml(xml);
+    BaseLib::ConfigTree conf(std::move(ptree), "", BaseLib::ConfigTree::onerror,
                              BaseLib::ConfigTree::onwarning);
     auto const& sub_config = conf.getConfigSubtree("time_stepping");
     return NumLib::createEvolutionaryPIDcontroller(sub_config);
diff --git a/Tests/ParameterLib/Parameter.cpp b/Tests/ParameterLib/Parameter.cpp
index cfb88954a712e9178f12dbc9d01d82a6efaefbbb..ed0b0ca72ea31d8d921710a53e22bbd23e8875a6 100644
--- a/Tests/ParameterLib/Parameter.cpp
+++ b/Tests/ParameterLib/Parameter.cpp
@@ -33,8 +33,9 @@ std::unique_ptr<Parameter<double>> constructParameterFromString(
              std::unique_ptr<MathLib::PiecewiseLinearInterpolation>> const&
         curves = {})
 {
-    auto const xml_ptree = Tests::readXml(xml.c_str());
-    BaseLib::ConfigTree config_tree(xml_ptree, "", BaseLib::ConfigTree::onerror,
+    auto xml_ptree = Tests::readXml(xml.c_str());
+    BaseLib::ConfigTree config_tree(std::move(xml_ptree), "",
+                                    BaseLib::ConfigTree::onerror,
                                     BaseLib::ConfigTree::onwarning);
     auto parameter_base = createParameter(config_tree, meshes, curves);
     return std::unique_ptr<Parameter<double>>(
diff --git a/Tests/ProcessLib/ComponentTransport/TestLookupTable.cpp b/Tests/ProcessLib/ComponentTransport/TestLookupTable.cpp
index 93a79c46eb9bda86cb96ba52acc716a606119770..390a288999c928a03d5932a7d4d242e81323b9ce 100644
--- a/Tests/ProcessLib/ComponentTransport/TestLookupTable.cpp
+++ b/Tests/ProcessLib/ComponentTransport/TestLookupTable.cpp
@@ -27,8 +27,8 @@ namespace
 {
 std::unique_ptr<LookupTable> createTestLookupTable(const char xml[])
 {
-    auto const ptree = Tests::readXml(xml);
-    BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror,
+    auto ptree = Tests::readXml(xml);
+    BaseLib::ConfigTree conf(std::move(ptree), "", BaseLib::ConfigTree::onerror,
                              BaseLib::ConfigTree::onwarning);
 
     std::vector<std::unique_ptr<MeshLib::Mesh>> meshes;