Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. invalid sizeof error
Forum Update on Monday, May 27th 2025

invalid sizeof error

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 549 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • RIVOPICOR Offline
    RIVOPICOR Offline
    RIVOPICO
    wrote on last edited by VRonin
    #1

    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.

    Pablo J. RoginaP 1 Reply Last reply
    0
    • RIVOPICOR RIVOPICO

      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.

      Pablo J. RoginaP Offline
      Pablo J. RoginaP Offline
      Pablo J. Rogina
      wrote on last edited by
      #2

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

      Upvote the answer(s) that helped you solve the issue
      Use "Topic Tools" button to mark your post as Solved
      Add screenshots via postimage.org
      Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      4
      • VRoninV Offline
        VRoninV Offline
        VRonin
        wrote on last edited by
        #3

        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

        "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
        ~Napoleon Bonaparte

        On a crusade to banish setIndexWidget() from the holy land of Qt

        1 Reply Last reply
        2

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved