diff --git a/Framework/API/test/MatrixWorkspaceTest.h b/Framework/API/test/MatrixWorkspaceTest.h
index 7d5368c9125905b4eb82ea8700ff3f60148fedff..527096d9f29ad4e03c400c2e2324b67cd1df24a9 100644
--- a/Framework/API/test/MatrixWorkspaceTest.h
+++ b/Framework/API/test/MatrixWorkspaceTest.h
@@ -1339,7 +1339,7 @@ public:
                  std::all_of(std::begin(readDx), std::end(readDx),
                              compareValueForSpecificWorkspaceIndex));
 
-      auto &refDx = ws.refDx(index);
+      auto refDx = ws.refDx(index);
       TSM_ASSERT("readDx should allow access to the spectrum",
                  std::all_of(std::begin(*refDx), std::end(*refDx),
                              compareValueForSpecificWorkspaceIndex));