From ad0c31419d5639adbd3e753a79d8051f21e4ab8a Mon Sep 17 00:00:00 2001
From: Eric Cano <Eric.Cano@cern.ch>
Date: Thu, 27 Sep 2018 18:11:34 +0200
Subject: [PATCH] Fixed nullopt static ocnstant not being compiled in.

It was used but we probably got away thanks to compiler optimizing it out.
---
 common/CMakeLists.txt | 3 ++-
 common/optional.cpp   | 6 +++++-
 common/optional.hpp   | 2 +-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
index 4e94819a07..a392ff6146 100644
--- a/common/CMakeLists.txt
+++ b/common/CMakeLists.txt
@@ -138,7 +138,8 @@ set (COMMON_LIB_SRC_FILES
   ConfigurationFile.cpp
   SourcedParameter.cpp   
   Timer.cpp
-  UserIdentity.cpp)
+  UserIdentity.cpp
+  optional.cpp)
 
 add_library (ctacommon SHARED
   ${COMMON_LIB_SRC_FILES})
diff --git a/common/optional.cpp b/common/optional.cpp
index c17d6ff9ff..8aa3389c17 100644
--- a/common/optional.cpp
+++ b/common/optional.cpp
@@ -23,4 +23,8 @@
 
 #include "optional.hpp"
 
-nullopt_t nullopt{};
+namespace cta{
+
+const cta::nullopt_t nullopt{};
+
+}
\ No newline at end of file
diff --git a/common/optional.hpp b/common/optional.hpp
index db9f7cccd2..364ac870bd 100644
--- a/common/optional.hpp
+++ b/common/optional.hpp
@@ -28,7 +28,7 @@ struct nullopt_t {
     nullopt_t() {}
 };
 
-extern nullopt_t nullopt;
+extern const nullopt_t nullopt;
 
 template <class T> class optional
 {
-- 
GitLab