Skip to content

[Bug]: boost.context fails in c++20 due to parse_headers #7158

@maliberty

Description

@maliberty

What happened?

I am trying to upgrade to Boost 1.89.0.bcr.2 but I get a compile error:

external/boost.context+/include/boost/context/detail/invoke.hpp:29:19: error: no type named 'result_of' in namespace 'std'
   29 |     typename std::result_of< Fn &&( Args && ... ) >::type
      |     ~~~~~~~~~~~~~~^~~~~~~~~

result_of is removed in c++20. I am using in my .bazelrc

build --cxxopt "-std=c++20"        --host_cxxopt "-std=c++20"

I have diagnosed this to be because of parse_headers in boost.context. Boost itself will avoid including this header in c++20 but parse_headers doesn't realize that. I can workaround it with a single_version_override to do - features = ["parse_headers"], but it is ugly.

I'm not enough of a bazel expert to propose a better solution but I hope other can.

Version

Development (host) and target OS/architectures: Ubuntu 24

Output of bazel --version: bazel 8.5.0

Version of relevant rules from the WORKSPACE or MODULE.bazel file: See description

Language(s) and/or frameworks involved: c++20 and Boost

How to reproduce

See description

Any other information?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions