sphinx-doc / sphinx-doc/sphinx

"Invalid C++ declaration" with C++ lambda expression

Open
#10,152 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

domains:cpp type:enhancement
Dominant language
Python
Stars
8k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

When building the Apache Arrow docs, we get the following warning:

/home/antoine/arrow/dev/docs/source/cpp/api/dataset.rst:62: WARNING: Parsing of expression failed. Using fallback parser. Error was:
Error in postfix expression, expected primary expression or type.
If primary expression:
  Invalid C++ declaration: Expected identifier in nested name. [error at 59]
    std::function< Status(FileWriter *)> writer_pre_finish   = [](FileWriter*) {returnStatus::OK();}
    -----------------------------------------------------------^
If type:
  Invalid C++ declaration: Expected identifier in nested name. [error at 59]
    std::function< Status(FileWriter *)> writer_pre_finish   = [](FileWriter*) {returnStatus::OK();}
    -----------------------------------------------------------^
How to Reproduce

The build procedure is a bit too complex to reproduce here. But I don't think that matters since the context is clear from the warning message above.

Expected behavior

Ideally there's a way to silence the warning. I understand that parsing C++ is hard, so I'm not necessarily expecting Sphinx to get it right in all cases :-) But the warning is distracting.

Your project

https://arrow.apache.org/

Screenshots

No response

OS

Ubuntu 20.04

Python version

3.9.7

Sphinx version

4.3.2

Sphinx extensions

breathe 4.31.0

Extra tools

doxygen 1.9.2

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with docs/source/cpp/api/dataset.rst and the reported Sphinx C++ declaration parsing warning; reproduce it through the Apache Arrow documentation build if possible. Trace the relevant parser or configuration entry point using the stated Sphinx 4.3.2, Breathe 4.31.0, and Doxygen 1.9.2 versions, with completion marked by handling the lambda without a distracting warning or identifying a way to silence it.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.