reference cpp constructor

16 views
Skip to first unread message

Robert Cohn

unread,
May 20, 2020, 4:24:02 PM5/20/20
to sphinx-users
I want to reference a specific overload of a cpp constructor. The first reference fails, but 2 & 3 succeed. Adding a void to a constructor reference seems wrong. What is the right way?

.. cpp:class:: Y

  .. cpp:function:: Y(int a)

  .. cpp:function:: Y(float)

  .. cpp:function:: void X(double)

:cpp:func:`Y::Y(int)`

:cpp:func:`void Y::Y(int)`

:cpp:func:`void Y::Y(float)`


cd /mnt/c/Users/rscohn1/local/Projects/spec/rst-overloads && make html
Running Sphinx v3.0.1
WARNING: html_static_path entry '_static' does not exist
loading pickled environment... done
building [mo]: all of 0 po files
building [html]: all source files
updating environment: 0 added, 1 changed, 0 removed
reading sources... [100%] index

looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index

/mnt/c/Users/rscohn1/local/Projects/spec/rst-overloads/source/index.rst:35: WARNING: Unparseable C++ cross-reference: 'Y::Y(int)()'
Error in cross-reference.
If shorthand ref:
  Invalid C++ declaration: Expected end of definition. [error at 4]
    Y::Y(int)()
    ----^
If full function ref:
  Error when parsing function declaration.
  If the function has no return type:
    Invalid C++ declaration: Expected end of definition. [error at 9]
      Y::Y(int)()
      ---------^
  If the function has a return type:
    Error in declarator
    If declarator-id with parameters-and-qualifiers:
      Invalid C++ declaration: Expected identifier in nested name. [error at 4]
        Y::Y(int)()
        ----^
    If parenthesis in noptr-declarator:
      Error in declarator or parameters-and-qualifiers
      If pointer to member declarator:
        Invalid C++ declaration: Expected identifier in nested name, got keyword: int [error at 8]
          Y::Y(int)()
          --------^
      If declarator-id:
        Invalid C++ declaration: Expected identifier in nested name, got keyword: int [error at 8]
          Y::Y(int)()
          --------^

generating indices...  genindexdone
writing additional pages...  searchdone
copying static files... ... done
copying extra files... done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded, 2 warnings.

The HTML pages are in build/html.
Reply all
Reply to author
Forward
0 new messages