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

typedef of unspecified type causes friend function documentation to be not documented #10847

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

Comments

@scott-zhong
Copy link

Describe the bug
typedef of unspecified type causes friend function documentation to be not documented.

/**
 * \relates A
 *
 * An unspecified type.
 */
typedef unspecified my_type;

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

/**
 * fun docs
 */
void fun(my_type);

fun() is not documented and the warning warning: Member fun(my_type) (friend) of class A is not documented. is produced

Screenshots
1.8.9.1 - trunk (85eb55d)
image

To Reproduce
testcase.zip

Expected behavior
fun() is documented.

@paule32
Copy link
Contributor

paule32 commented May 1, 2024

you define a type my_type based on unspecified.
so, either unspecified must be exists before you define my_type or you use an already existing type.
the next problem I see is, that you don't give the type an argument for the member declaration.
should it not be void fun(my_type arg1) ?

I think it is a usage problem.

@scott-zhong
Copy link
Author

Argument name isn't required, especially if the function doesn't use the argument (you'll get a compiler warning about unused variable if you do).

I don't think this is a usage problem because even if we define unspecified type, Doxygen still thinks that it is an undocumented member. For example

struct unspecified
{
};

/**
 * \relates A
 *
 * An unspecified type.
 */
typedef unspecified my_type;

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

/**
 * fun docs
 */
void fun(my_type);

fun() would still be undocumented. Whereas if we switch to an int type then fun() is now documented.

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

/**
 * fun docs
 */
void fun(int);

@doxygen
Copy link
Owner

doxygen commented May 12, 2024

@scott-zhong The problem is the \relates command, which makes doxygen treat the typedef as a member of A, but then when resolving the type in fun's declaration it searches for the type in the global scope where it is not found, while for the friend declaration it is found.

In older versions of doxygen, the scope resolution was less strict and the member could still be found (which sometimes led to links to the wrong symbol).

doxygen added a commit that referenced this issue May 12, 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 albert-github added bug fixed but not released Bug is fixed in github, but still needs to make its way to an official release C/C++ labels May 12, 2024
@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
Projects
None yet
Development

No branches or pull requests

4 participants