From cc53bf6bdc68683545607bb2514bbd374dc66f9e Mon Sep 17 00:00:00 2001
From: Anton Piccardo-Selg <anton.piccardo-selg@tessella.com>
Date: Mon, 19 Oct 2015 16:51:46 +0100
Subject: [PATCH] Refs #13872 handle gcc warnings because of optional

---
 .../DataObjects/src/MDFramesToSpecialCoordinateSystem.cpp    | 4 ++++
 Framework/DataObjects/src/MDHistoWorkspace.cpp               | 5 +++++
 Framework/MDAlgorithms/test/ConvertToReflectometryQTest.h    | 3 ---
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/Framework/DataObjects/src/MDFramesToSpecialCoordinateSystem.cpp b/Framework/DataObjects/src/MDFramesToSpecialCoordinateSystem.cpp
index e597689320e..8331e3b173e 100644
--- a/Framework/DataObjects/src/MDFramesToSpecialCoordinateSystem.cpp
+++ b/Framework/DataObjects/src/MDFramesToSpecialCoordinateSystem.cpp
@@ -1,6 +1,7 @@
 #include "MantidDataObjects/MDFramesToSpecialCoordinateSystem.h"
 #include "MantidAPI/IMDEventWorkspace.h"
 #include "MantidAPI/IMDHistoWorkspace.h"
+#include "MantidKernel/WarningSuppressions.h"
 
 namespace Mantid {
 namespace DataObjects {
@@ -9,6 +10,8 @@ MDFramesToSpecialCoordinateSystem::MDFramesToSpecialCoordinateSystem() {}
 
 MDFramesToSpecialCoordinateSystem::~MDFramesToSpecialCoordinateSystem() {}
 
+// Need to turn off the warnings because of boost optional being used.
+GCC_DIAG_OFF(maybe-uninitialized)
 /**
  * Get the Special Coordinate System based on the MDFrame information.
  * @param workspace: the workspace which is being queried
@@ -57,6 +60,7 @@ boost::optional<Mantid::Kernel::SpecialCoordinateSystem>
 
   return output;
 }
+GCC_DIAG_ON(maybe-uninitialized)
 
 /**
  * Make sure that the QFrame types are the same.
diff --git a/Framework/DataObjects/src/MDHistoWorkspace.cpp b/Framework/DataObjects/src/MDHistoWorkspace.cpp
index 6e9b7acca20..97c197b3e99 100644
--- a/Framework/DataObjects/src/MDHistoWorkspace.cpp
+++ b/Framework/DataObjects/src/MDHistoWorkspace.cpp
@@ -3,6 +3,7 @@
 #include "MantidKernel/System.h"
 #include "MantidKernel/Utils.h"
 #include "MantidKernel/VMD.h"
+#include "MantidKernel/WarningSuppressions.h"
 #include "MantidDataObjects/MDHistoWorkspace.h"
 #include "MantidDataObjects/MDHistoWorkspaceIterator.h"
 #include "MantidDataObjects/MDFramesToSpecialCoordinateSystem.h"
@@ -1213,9 +1214,11 @@ uint64_t MDHistoWorkspace::sumNContribEvents() const {
   return sum;
 }
 
+
 /**
  * Get the Q frame system (if any) to use.
 */
+GCC_DIAG_OFF(strict-aliasing)
 Kernel::SpecialCoordinateSystem
 MDHistoWorkspace::getSpecialCoordinateSystem() const {
   MDFramesToSpecialCoordinateSystem converter;
@@ -1227,6 +1230,8 @@ MDHistoWorkspace::getSpecialCoordinateSystem() const {
 
   return coordinates;
 }
+GCC_DIAG_ON(strict-aliasing)
+
 
 /**
 Set the special coordinate system (if any) to use.
diff --git a/Framework/MDAlgorithms/test/ConvertToReflectometryQTest.h b/Framework/MDAlgorithms/test/ConvertToReflectometryQTest.h
index 382e63bc6c4..2804987b76d 100644
--- a/Framework/MDAlgorithms/test/ConvertToReflectometryQTest.h
+++ b/Framework/MDAlgorithms/test/ConvertToReflectometryQTest.h
@@ -160,9 +160,6 @@ public:
     const auto &frame0 = ws->getDimension(0)->getMDFrame();
     TSM_ASSERT_EQUALS("Should be a QLab frame",
                       Mantid::Geometry::QLab::QLabName, frame0.name());
-    TSM_ASSERT_THROWS_NOTHING(
-        "Should be a QLab frame",
-        const auto &tmp = dynamic_cast<const Mantid::Geometry::QLab &>(frame0));
     TSM_ASSERT_EQUALS(
         "Should have a special coordinate system selection of QLab",
         ws->getSpecialCoordinateSystem(), Mantid::Kernel::QLab);
-- 
GitLab