From a7d069c20aa2a4859456cd95dd7b85a6f88267d6 Mon Sep 17 00:00:00 2001
From: Sam Yates <halfflat@gmail.com>
Date: Tue, 16 Aug 2016 13:27:05 +0200
Subject: [PATCH] Address code review on PR#77.

---
 src/util/nop.hpp        | 10 ++++++++--
 tests/unit/test_nop.cpp |  4 ++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/util/nop.hpp b/src/util/nop.hpp
index 8315e93f..6ec568b9 100644
--- a/src/util/nop.hpp
+++ b/src/util/nop.hpp
@@ -12,7 +12,7 @@ namespace nest {
 namespace mc {
 namespace util {
 
-static struct nop_function_t {
+struct nop_function_t {
     template <typename R, typename... Args>
     operator std::function<R (Args...)>() const {
         return [](Args...) { return R{}; };
@@ -22,7 +22,13 @@ static struct nop_function_t {
     operator std::function<void (Args...)>() const {
         return [](Args...) { };
     }
-} nop_function;
+
+    // keep clang happy: see CWG issue #253,
+    // http://open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#253
+    constexpr nop_function_t() {}
+};
+
+static constexpr nop_function_t nop_function;
 
 } // namespace util
 } // namespace mc
diff --git a/tests/unit/test_nop.cpp b/tests/unit/test_nop.cpp
index cf131d9e..e3571ad8 100644
--- a/tests/unit/test_nop.cpp
+++ b/tests/unit/test_nop.cpp
@@ -3,7 +3,7 @@
 
 using namespace nest::mc::util;
 
-TEST(nop,void_fn) {
+TEST(nop, void_fn) {
     std::function<void ()> f{nop_function};
 
     EXPECT_TRUE(f);
@@ -42,7 +42,7 @@ struct check_default {
     explicit check_default(int n): value(n) {}
 };
 
-TEST(nop,default_return_fn) {
+TEST(nop, default_return_fn) {
     std::function<check_default ()> f{nop_function};
 
     EXPECT_TRUE(f);
-- 
GitLab