From: Francis Dupont Date: Wed, 13 May 2026 09:00:45 +0000 (+0200) Subject: [#3991] Fixed returnByReference in optional.h X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=32f8a63115ae00678a5edace57dcb231ae33ed08;p=thirdparty%2Fkea.git [#3991] Fixed returnByReference in optional.h --- diff --git a/src/lib/util/optional.h b/src/lib/util/optional.h index 40c6df221d..a9cea63343 100644 --- a/src/lib/util/optional.h +++ b/src/lib/util/optional.h @@ -10,6 +10,7 @@ #include #include #include +#include namespace isc { namespace util { @@ -161,6 +162,10 @@ public: protected: T default_; ///< Encapsulated value. bool unspecified_; ///< Flag which indicates if the value is specified. + +private: + // Refuse instantiation by a reference type. + static_assert(!std::is_reference::value, "!std::is_reference::value"); }; /// @brief Specialization of the default @c Optional constructor for