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

Unable to document default argument on friend functions #10846

Closed
scott-zhong opened this issue May 1, 2024 · 6 comments
Closed

Unable to document default argument on friend functions #10846

scott-zhong opened this issue May 1, 2024 · 6 comments
Labels
C/C++ enhancement a request to enhance doxygen, not a bug

Comments

@scott-zhong
Copy link

Describe the bug
Unable to document default argument on friend functions

/**
 * A docs
 */
class A
{
public:
    friend void fun(int i);
};

/**
 * fun docs
 */
void fun(int i = 0);

Does not show the default argument int i =0. The standard prohibits default argument in friend function declaration.

§8.3.6 If a friend declaration specifies a default argument expression, that declaration shall be a definition and shall be the only declaration of the function or function template in the translation unit.

It looks like Doxygen uses the friend declaration of the function instead of the definition.

Screenshots
1.8.9.1 - trunk (85eb55d)
image

The default argument int i = 0 is not documented.

To Reproduce
testcase.zip

Expected behavior
The default argument int i = 0 is documented.

@albert-github albert-github added enhancement a request to enhance doxygen, not a bug C/C++ labels May 1, 2024
@doxygen
Copy link
Owner

doxygen commented May 12, 2024

@scott-zhong Please verify if the referenced commit fixes the problem for you. Do not close the issue, this will be done automatically when the next official release becomes available.

@albert-github
Copy link
Collaborator

albert-github commented May 12, 2024

In the file html/class_a.html I still don't see the initialization:

image

nor

image

@doxygen
Copy link
Owner

doxygen commented May 12, 2024

@albert-github Thanks for checking. I noticed I was testing with a modified version of the example, which make the fix appear to work. I just committed a second attempt.

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

Looks OK now, also when using:

friend void fun(int j);

or

friend void fun(int);

the results look OK to me, i.e.

image

and

image

@scott-zhong
Copy link
Author

@doxygen verified the fix. Thank you!!!

@doxygen
Copy link
Owner

doxygen commented May 20, 2024

This issue was previously marked 'fixed but not released',
which means it should be fixed in doxygen version 1.11.0.
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 May 20, 2024
@doxygen doxygen closed this as completed May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C/C++ enhancement a request to enhance doxygen, not a bug
Projects
None yet
Development

No branches or pull requests

3 participants