Skip to content

Support C++20's spaceship operator #8942

Closed

Description

@TobyBrull

C++20 has the new spaceship operator <=> for three way comparisons which can also be defaulted (not sure if the latter matters to Sphinx).

I hope this is a problem with Sphinx at all and not with the Breathe extension I'm also using.

For example, this reST code in Sphinx

.. cpp:function:: std::strong_ordering operator<=>(Foo, Foo)

currently leads to the following warning/error

WARNING: Error when parsing function declaration.
If the function has no return type:
  Error in declarator or parameters-and-qualifiers
  Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 21]
    std::strong_ordering operator<=>(Foo, Foo)
    ---------------------^
If the function has a return type:
  Error in declarator or parameters-and-qualifiers
  If pointer to member declarator:
    Invalid C++ declaration: Expected '::' in pointer to member (function). [error at 31]
      std::strong_ordering operator<=>(Foo, Foo)
      -------------------------------^
  If declarator-id:
    Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 31]
      std::strong_ordering operator<=>(Foo, Foo)
      -------------------------------^

Activity

  1. added
    type:enhancement
    on Feb 28, 2021
  2. self-assigned this
    on Mar 2, 2021
  3. added this to the 4.0.0 milestone on Mar 2, 2021
  4. added a commit that references this issue on Mar 2, 2021
    4052cbc
  5. jakobandersen commented on Mar 2, 2021

    @jakobandersen
    Contributor

    Thanks! Added in master, to be released in v4.

  6. added a commit that references this issue on Mar 11, 2021
    3134085
  7. locked as resolved and limited conversation to collaborators on Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

domains:cpptype:enhancement

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions