Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

invalid sizeof error



  • I just got this error

    /usr/include/boost/variant/get.hpp:178: error: invalid application of 'sizeof' to incomplete type 'boost::STATIC_ASSERTION_FAILURE<false>'
         BOOST_STATIC_ASSERT_MSG(
         ^
    

    the code

    // strict_get<U>(variant) methods
    //
    template <typename U, BOOST_VARIANT_ENUM_PARAMS(typename T) >
    inline
        typename add_pointer<U>::type
    strict_get(
          boost::variant< BOOST_VARIANT_ENUM_PARAMS(T) >* operand
          BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(U)
        ) BOOST_NOEXCEPT
    {
        BOOST_STATIC_ASSERT_MSG(
            (boost::detail::variant::holds_element<boost::variant< BOOST_VARIANT_ENUM_PARAMS(T) >, U >::value),
            "boost::variant does not contain specified type U, "
            "call to boost::get<U>(boost::variant<T...>*) will always return NULL"
        );
    
        return relaxed_get<U>(operand);
    }
    

    Error is in line
    BOOST STATIC MSG ADD.



  • @RIVOPICO Hi, should you get better answers in Boost users list? Not sure how this apply to Qt framework



  • The error doesn't come in from boost::variant but from how you use it. You should check the "referenced in" part of the error


Log in to reply