• Lunderberg's avatar
    Fixed compilation error when binding function accepting some forms of std::function (#689) · c7fcde7c
    Lunderberg authored
    * Fixed compilation error when defining function accepting some forms of std::function.
    
    The compilation error happens only when the functional.h header is
    present, and the build is done in debug mode, with NDEBUG being
    undefined.  In addition, the std::function must accept an abstract
    base class by reference.
    
    The compilation error occurred in cast.h, when trying to construct a
    std::tuple<AbstractBase>, rather than a std::tuple<AbstractBase&>.
    This was caused by functional.h using std::move rather than
    std::forward, changing the signature of the function being used.
    
    This commit contains the fix, along with a test that exhibits the
    issue when compiled in debug mode without the fix applied.
    
    * Moved new std::function tests into test_callbacks, added callback_with_movable test.
    c7fcde7c
test_callbacks.cpp 5.48 KB