From bc6eedb6cb31c034ea62ad96e3bca54d7b069c38 Mon Sep 17 00:00:00 2001
From: Verena Reimund <reimund@ill.eu>
Date: Wed, 9 May 2018 13:00:09 +0200
Subject: [PATCH] Attempt to fix build failures
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Refs #22383

OSX
FAILED: Framework/SINQ/test/CMakeFiles/PSISINQTest.dir/PoldiIndexKnownCompoundsTest.cpp.o
In file included from Framework/SINQ/test/PoldiIndexKnownCompoundsTest.cpp:17:
PoldiIndexKnownCompoundsTest.h:40:5: error: no matching function for call to 'storeWS'
    WorkspaceCreationHelper::storeWS(
WorkspaceCreationHelper.h:114:33: note: candidate function [with WSType = boost::shared_ptr<Mantid::DataObjects::TableWorkspace>] not viable: expects an l-value for 2nd argument
template <typename WSType> void storeWS(const std::string &name, WSType &ws) {
In file included from Framework/SINQ/test/PoldiIndexKnownCompoundsTest.cpp:17:
PoldiIndexKnownCompoundsTest.h:43:5: error: no matching function for call to 'storeWS'
    WorkspaceCreationHelper::storeWS(
WorkspaceCreationHelper.h:114:33: note: candidate function [with WSType = boost::shared_ptr<Mantid::DataObjects::TableWorkspace>] not viable: expects an l-value for 2nd argument
template <typename WSType> void storeWS(const std::string &name, WSType &ws) {
In file included from Framework/SINQ/test/PoldiIndexKnownCompoundsTest.cpp:17:
PoldiIndexKnownCompoundsTest.h:673:7: error: no matching function for call to 'storeWS'
      WorkspaceCreationHelper::storeWS(
WorkspaceCreationHelper.h:114:33: note: candidate function [with WSType = boost::shared_ptr<Mantid::DataObjects::Workspace2D>] not viable: expects an l-value for 2nd argument
template <typename WSType> void storeWS(const std::string &name, WSType &ws) {
3 errors generated.

Linux
PoldiIndexKnownCompoundsTest.h:42:66: error: invalid initialization of non-const reference of type ‘boost::shared_ptr<Mantid::DataObjects::TableWorkspace>&’ from an rvalue of type ‘Mantid::DataObjects::TableWorkspace_sptr {aka boost::shared_ptr<Mantid::DataObjects::TableWorkspace>}’
          PoldiPeakCollectionHelpers::createPoldiPeakTableWorkspace());
PoldiIndexKnownCompoundsTest.cpp:17:
WorkspaceCreationHelper.h:114:33: note:   initializing argument 2 of ‘void WorkspaceCreationHelper::storeWS(const string&, WSType&) [with WSType = boost::shared_ptr<Mantid::DataObjects::TableWorkspace>; std::__cxx11::string = std::__cxx11::basic_string<char>]’
10:35:30  template <typename WSType> void storeWS(const std::string &name, WSType &ws) {
PoldiIndexKnownCompoundsTest.cpp:17:0:
PoldiIndexKnownCompoundsTest.h:46:31: error: invalid initialization of non-const reference of type ‘boost::shared_ptr<Mantid::DataObjects::TableWorkspace>&’ from an rvalue of type ‘Mantid::DataObjects::TableWorkspace_sptr {aka boost::shared_ptr<Mantid::DataObjects::TableWorkspace>}’
              ->asTableWorkspace());
WorkspaceCreationHelper.h:114:33: note:   initializing argument 2 of ‘void WorkspaceCreationHelper::storeWS(const string&, WSType&) [with WSType = boost::shared_ptr<Mantid::DataObjects::TableWorkspace>; std::__cxx11::string = std::__cxx11::basic_string<char>]’
  template <typename WSType> void storeWS(const std::string &name, WSType &ws) {
PoldiIndexKnownCompoundsTest.cpp:17:0:
PoldiIndexKnownCompoundsTest.h: In member function ‘void PoldiIndexKnownCompoundsTest::storeRandomWorkspaces(const std::vector<std::__cxx11::basic_string<char> >&)’:
PoldiIndexKnownCompoundsTest.h:674:65: error
---
 .../SINQ/test/PoldiIndexKnownCompoundsTest.h     | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/Framework/SINQ/test/PoldiIndexKnownCompoundsTest.h b/Framework/SINQ/test/PoldiIndexKnownCompoundsTest.h
index 302ef9bc829..a506a6a9f00 100644
--- a/Framework/SINQ/test/PoldiIndexKnownCompoundsTest.h
+++ b/Framework/SINQ/test/PoldiIndexKnownCompoundsTest.h
@@ -37,13 +37,13 @@ public:
     /* In this test, peaks from PoldiMockInstrumentHelpers (Silicon)
      * are indexed using theoretical Si-peaks.
      */
-    WorkspaceCreationHelper::storeWS(
-        "measured_SI",
-        PoldiPeakCollectionHelpers::createPoldiPeakTableWorkspace());
-    WorkspaceCreationHelper::storeWS(
-        "Si",
+    auto wsMeasuredSi =
+        PoldiPeakCollectionHelpers::createPoldiPeakTableWorkspace();
+    WorkspaceCreationHelper::storeWS("measured_SI", wsMeasuredSi);
+    auto wsSi =
         PoldiPeakCollectionHelpers::createTheoreticalPeakCollectionSilicon()
-            ->asTableWorkspace());
+            ->asTableWorkspace();
+    WorkspaceCreationHelper::storeWS("Si", wsSi);
 
     std::string outWSName("PoldiIndexKnownCompoundsTest_OutputWS");
 
@@ -670,8 +670,8 @@ private:
 
   void storeRandomWorkspaces(const std::vector<std::string> &wsNames) {
     for (const auto &wsName : wsNames) {
-      WorkspaceCreationHelper::storeWS(
-          wsName, WorkspaceCreationHelper::create1DWorkspaceRand(10, true));
+      auto ws = WorkspaceCreationHelper::create1DWorkspaceRand(10, true)
+          WorkspaceCreationHelper::storeWS(wsName, ws);
     }
   }
 
-- 
GitLab