I'm trying to subclass std::optional in MS C++17 (VS2017) to add a message field to the class, but getting the compile error
error C2280: '
OptMsg<bool>::OptMsg(const OptMsg<bool> &)': attempting to reference a deleted function
Intellisense gives a little more insight:
function "
OptMsg<T>::OptMsg(const OptMsg<bool> &) throw() [with T=bool]" (declared implicitly) cannot be referenced -- it is a deleted function
Which tells me the compiler has in issue with my copy constructor referencing the deleted function throw? I get the error return an instance from a function. E.g.,
OptMsg<bool> foo()
{
    OptMsg<bool> res = false;
    return res; // <-- Getting compile error here
}
Here's my class. Any insights are appreciated!
template <class T>
class KB_MAPPING_ENGINE_API OptMsg : public std::optional<T>
{
public:
    constexpr OptMsg() noexcept
        : optional{}
        {}
    constexpr OptMsg(std::nullopt_t) noexcept
        : optional{}
        {}
    constexpr OptMsg(const T & other) noexcept
        : optional<T>{other}
        , m_Message{other.m_Message}
        {}
    constexpr explicit OptMsg(const T && other) noexcept
        : optional<T>{other}
        , m_Message{other.m_Message}
        {}
    OptMsg & operator = ( const OptMsg & other ) noexcept
    {
        if ( &other != this )
            m_Message = other.m_Message;
        return *this;
    }
    OptMsg && operator = ( const OptMsg && other )
    {
        if ( &other != this )
            m_Message = other.m_Message;
        return *this;
    }
    void SetMessage( const std::string & message ) { m_Message = message; }
    std::string GetMessage() { return m_Message; }
private:
    std::string m_Message;
};