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

[C++] Inherited virtual functions are not listed as being inherited in child class docs #10081

Closed
seemann5 opened this issue May 24, 2023 · 7 comments

Comments

@seemann5
Copy link

The problem

Publically inherited public functions are normally listed in the Public Member Functions inherited from parent class section. This behavior does not work as expected when the parent function is marked as virtual, in which case the parent function ends up listed in the main Public Member Functions section, without mentioning the inheritance relation, which looks a bit confusing.

Screenshots

  • The non-virtual case that works as expected:
    doxygen_mwe_case_ok
  • The virtual case that does not work as expected:
    doxygen_mwe_case_fail

To Reproduce

Using doxygen built from source, version

$ doxygen -v
1.9.8 (04693545bc3b41e42a8c1a2d4a5d0ae036bf23b4)

on WSL, running Ubuntu 20.04.6.
The above screenshots are generated as:

$ touch a.hpp
$ vim a.hpp (<- here inserting the below file)
$ doxygen -g (fresh doxyfile with default options)
$ doxygen

where a.hpp consists of

// The satisfying case

class A_ok {
public:
    /*! \brief the A_ok::f_ok() method is shown in the documentation of B_ok as inherited from A_ok */
    void f_ok();
};
class B_ok : public A_ok {
public:
    /*! \brief the override B_ok::f_ok() */
    void f_ok();
};

// The problematic case

class A_fail {
public:
    /*! \brief the A_fail::f_fail() method is shown in the documentation of B_fail as *not* inherited from A_fail */
    virtual void f_fail();
};
class B_fail : public A_fail {
public:
    /*! \brief the override B_fail::f_fail() */
    void f_fail();
};

Extra information

I tried playing around with marking B_fail::f_fail() as either

void f_fail();
virtual void f_fail();
virtual void f_fail() override;
void f_fail() override;

but this doesn't seem to solve the issue.

@seemann5
Copy link
Author

Update

Adding a documented constructor to the parent class, so the class A_fail in the above example, solves the problem.
This works well as a quick fix, but is slightly annoying for pure interfaces.

@doxygen
Copy link
Owner

doxygen commented May 25, 2023

Interesting finding, seems to be broken like this since 1.9.3 already.

doxygen added a commit that referenced this issue May 28, 2023
@doxygen
Copy link
Owner

doxygen commented May 28, 2023

@seemann5 Please verify if the referenced commit fixes the problem for you. Don't close the issue as this will be done automatically when the next version of doxygen is released.

Note that A_fail's f_fail() should actually not show up as a method of B_fail as it has been reimplemented by B_fail. This is now corrected.

@doxygen doxygen added the fixed but not released Bug is fixed in github, but still needs to make its way to an official release label May 28, 2023
@albert-github
Copy link
Collaborator

@doxygen I think we can have a nullptr problem here:

    int count = cd->countMembersIncludingGrouped(m_listType,inheritedFrom,TRUE);
    if ( cd && !optimizeVhdl && count>0 )

should probably be:

    int count = (cd ? cd->countMembersIncludingGrouped(m_listType,inheritedFrom,TRUE) : 0);
    if ( !optimizeVhdl && count>0 )

doxygen added a commit that referenced this issue May 28, 2023
@doxygen
Copy link
Owner

doxygen commented May 28, 2023

@albert-github Good catch. I isolated the counter for debugging purposes, reverted that part of the change now.

@seemann5
Copy link
Author

I just pulled, the new version works as expected! Thanks a lot!

@doxygen
Copy link
Owner

doxygen commented Aug 25, 2023

This issue was previously marked 'fixed but not released',
which means it should be fixed in doxygen version 1.9.8.
Please verify if this is indeed the case. Reopen the
issue if you think it is not fixed and please include any additional information
that you think can be relevant (preferably in the form of a self-contained example).

@doxygen doxygen removed the fixed but not released Bug is fixed in github, but still needs to make its way to an official release label Aug 25, 2023
@doxygen doxygen closed this as completed Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
@doxygen @albert-github @seemann5 and others