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

Something broke with C++ templates/namespaces between 4.0.3 and 4.1.2 #9584

Closed
cary-ilm opened this issue Aug 26, 2021 · 1 comment
Closed

Comments

@cary-ilm
Copy link

Describe the bug

I have a C++ class template inside a namespace and all was good with Sphinx 4.0.3, but it fails with 4.1.2, but only when invoked by readthedocs. Error is:

  File "/home/docs/checkouts/readthedocs.org/user_builds/cary-ilm-docs-test/envs/latest/lib/python3.7/site-packages/sphinx/util/cfamily.py", line 275, in fail
    raise self._make_multi_error(errors, '')
sphinx.util.cfamily.DefinitionError: Invalid C++ declaration: Expected identifier in nested name. [error at 5]
  class
  -----^

Exception occurred:
  File "/home/docs/checkouts/readthedocs.org/user_builds/cary-ilm-docs-test/envs/latest/lib/python3.7/site-packages/sphinx/util/cfamily.py", line 275, in fail
    raise self._make_multi_error(errors, '')
sphinx.util.cfamily.DefinitionError: Invalid C++ declaration: Expected identifier in nested name. [error at 5]
  class
  -----^

The template is:

template <class T> class Vec
{
  public:
    constexpr Vec (const Vec& v) noexcept;
    template <class S>  constexpr Vec (const Vec<S>& v) noexcept;
};

template <class T>
constexpr inline Vec<T>::Vec (const Vec& v) noexcept
{
}

template <class T> template <class S>
constexpr inline Vec<T>::Vec (const Vec<S>& v) noexcept
{
}

}

This is referenced in index.rst via:

.. doxygenclass:: Test::Vec
   :undoc-members:
   :members:

It seems to be triggered by a combination of the template and the namespace. Removing the namespace makes the error go away. The error also only seems to happen with both constructors are included.

If I revert the sphinx version to 4.0.3, no error.

Full log for the failed 4.1.2 build: https://readthedocs.org/api/v2/build/14568472.txt
Log for the successful 4.0.3 build: https://readthedocs.org/api/v2/build/14568456.txt

The only difference between the two builds is the line in requirements.txt that specifies the sphinx version.

How to Reproduce

Here is a simple pared-down repo that illustrates the problem: https://github.com/cary-ilm/docs-test
The readthedocs project is: https://readthedocs.org/projects/cary-ilm-docs-test/

The project specifies the sphinx version in docs/requirements.txt. 4.0.3 works fine, 4.1.2 fails.

Running sphinx 4.1.2 locally works fine, it only fails when invoked via readthedocs.

Expected behavior

No response

Your project

https://github.com/cary-ilm/docs-test

Screenshots

No response

OS

ubuntu 20, but the problem is on readthedocs.

Python version

3.7

Sphinx version

4.1.2

Sphinx extensions

breathe

Extra tools

No response

Additional context

No response

cary-ilm added a commit to cary-ilm/Imath that referenced this issue Aug 27, 2021
There seems to be a bug in newer versions of Sphinx that cause the
readthedocs build to fail, reported here:
sphinx-doc/sphinx#9584.

Until that is resolved, this avoids it.

Signed-off-by: Cary Phillips <[email protected]>
cary-ilm added a commit to AcademySoftwareFoundation/Imath that referenced this issue Aug 27, 2021
There seems to be a bug in newer versions of Sphinx that cause the
readthedocs build to fail, reported here:
sphinx-doc/sphinx#9584.

Until that is resolved, this avoids it.

Signed-off-by: Cary Phillips <[email protected]>
@jakobandersen
Copy link
Contributor

Thanks for reporting. I'm quite sure this is a duplicate of #9449, #9433, #9460, and #9477 though, but otherwise please reopen or post a new issue.
The problem is in Breathe and I think it should be fixed by breathe-doc/breathe#711. Using that branch locally, your example compiles locally for me.

cary-ilm added a commit to cary-ilm/Imath that referenced this issue Aug 30, 2021
There seems to be a bug in newer versions of Sphinx that cause the
readthedocs build to fail, reported here:
sphinx-doc/sphinx#9584.

Until that is resolved, this avoids it.

Signed-off-by: Cary Phillips <[email protected]>
cary-ilm added a commit to AcademySoftwareFoundation/Imath that referenced this issue Sep 1, 2021
There seems to be a bug in newer versions of Sphinx that cause the
readthedocs build to fail, reported here:
sphinx-doc/sphinx#9584.

Until that is resolved, this avoids it.

Signed-off-by: Cary Phillips <[email protected]>
seanmiddleditch added a commit to seanmiddleditch/nanofmt that referenced this issue Sep 13, 2021
seanmiddleditch added a commit to seanmiddleditch/nanofmt that referenced this issue Sep 13, 2021
* Use Python exhale module to auto-invoke Doxygen

* Update GitHub Action for using Exhale

* Deploy should only run on push to main, not PRs

* CI docs gen fixes

* Use requirements.txt, remove Doxygen from CI

* Require older Sphinx

sphinx-doc/sphinx#9584

* Still need doxygen installed, just not auto-run

* Fix API references for newer versions of Sphinx/Breathe

* Move reference to fmtlib authors so they don't get the blame for nanofmt :)
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 27, 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