Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross-referencing a function that returns a pointer with :cpp:func: causes error "Invalid definition: Expected end of definition" #6208

Closed
daniellovell opened this issue Mar 26, 2019 · 3 comments
Assignees
Milestone

Comments

@daniellovell
Copy link

daniellovell commented Mar 26, 2019

Describe the bug
While using the :cpp:func: directive to cross-reference a C++ function that returns a pointer, you will receivean error that the * character in the reference is "unparseable". This makes it impossible to cross-reference a function with a pointer return value

To Reproduce
Steps to reproduce the behavior:

Source (C++):

class Foo
{
    public:
        Foo* Bar();
}   

Sphinx (reStructuredText):

:cpp:func:`Foo* Foo::Bar()`

Result:

WARNING: Unpareseable C++ cross-reference: 'Foo*'
Invalid definition: Expected end of definition. [error at 4]
   Foo*
   ---^

Expected behavior
The expected behavior is to output a properly cross-referenced link to the Foo* Foo::Bar() function.

Your project
N/A

Screenshots
N/A

Environment info

  • OS: [e.g. Unix/Linux/Mac/Win/other with version]
  • Python version: 3.7.0
  • Sphinx version: 2.0.0+
  • Sphinx extensions: breathe
  • Extra tools: N/A
@jakobandersen
Copy link
Contributor

Thanks for reporting, this is indeed a bug. Note though that there are two formats for function references: (1) a full signature (as you write), for referencing a specific overload, and (2) just the name of the function (here Foo::Bar), which references an arbitrary overload. Format (2) should still work.

@daniellovell
Copy link
Author

Hi Jakob, thanks for taking a look at the issue. I can confirm that the format (2) you described works as intended, and even most full signatures work correctly with the exception of functions that return pointers.

jakobandersen added a commit to jakobandersen/sphinx that referenced this issue Mar 30, 2019
jakobandersen added a commit to jakobandersen/sphinx that referenced this issue Apr 1, 2019
@jakobandersen jakobandersen added this to the 2.0.1 milestone Apr 4, 2019
@jakobandersen
Copy link
Contributor

This should be fixed in version 2.0.1.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants