sphinx-doc / sphinx-doc/sphinx

C++, type lookup in function with parameter of same name

Open
#7,740 0 comments 0 reactions 1 assignee View on GitHub

@jakobandersen is already working on this.

Since May 28, 2020.

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

Description

Describe the bug
When the same name is used for a function parameter as for a type used in the same declaration,
then the type sometimes gets linked to the wrong thing.

To Reproduce
Steps to reproduce the behavior:

.. cpp:struct:: abc::something

	.. cpp:var:: int x  

.. cpp:struct:: abc::otherthing

	.. cpp:function:: otherthing(const something &something)

		The ``something`` type gets linked to the ``something`` variable,
		instead of the ``something`` class.

Expected behavior
When making cross-reference in function declarations the lookup should take the relative position inside the declaration into account.

Environment info
Any Sphinx version.

Additional context
See michaeljones/breathe#536.
Also, the C domain probably has the same bug.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.