Skip to content

std::unary_function deprecation warning with GCC 12 #22

@joaquintides

Description

@joaquintides

Starting in GCC 12, the compiler emits a warning when std::unary_function/std::binary_function is used (they haven't gone as far as removing these for C++ standard versions beyond 14 as mandated). This affects boost::hash as it conditionally uses std::unary_function based on BOOST_NO_CXX98_FUNCTION_BASE, which, correctly, is still undefined for GCC 12.

There are various alternatives to deal with this:

  • Stop using std::unary_function altogether (unlikely, it may break C++03 user code).
  • Stop using it based on a combination of BOOST_NO_CXX98_FUNCTION_BASE and __cplusplus.
  • Wrap in warning-stopping pragma.

Thank you,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions