diff --git a/src/util/optional.hpp b/src/util/optional.hpp
index f1fb805bfb86062f1c7c603befd5f01d54fad5f2..a3c2da998d468c8564894f2db61b0340c056c70c 100644
--- a/src/util/optional.hpp
+++ b/src/util/optional.hpp
@@ -107,7 +107,7 @@ namespace detail {
 
         template <typename Y>
         bool operator==(const optional<Y> &o) const {
-            return set && o.set && ref()==o.ref() || !set && !o.set;
+            return (set && o.set && ref()==o.ref()) || (!set && !o.set);
         }
 
         void reset() {
diff --git a/tests/test_optional.cpp b/tests/test_optional.cpp
index e3ca5ecbbd7466c7f5e7b6a9c2f7bcbef43dd5b1..64df6cac9da0dcdeff1661381a46d933c6356210 100644
--- a/tests/test_optional.cpp
+++ b/tests/test_optional.cpp
@@ -5,6 +5,11 @@
 #include "gtest.h"
 #include "util/optional.hpp"
 
+#if defined(__clang__)
+// refer: https://llvm.org/bugs/show_bug.cgi?id=21629
+#pragma clang diagnostic ignored "-Wmissing-braces"
+#endif
+
 using namespace nest::mc::util;
 
 TEST(optionalm,ctors) {