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

if "using namespace" used, call of a static member function in C++ is not recognized or recognized wrong (Origin: bugzilla #154880) #1293

Closed
doxygen opened this Issue Jul 1, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@doxygen
Copy link
Owner

doxygen commented Jul 1, 2018

status RESOLVED severity normal in component build for ---
Reported in version 1.5.3-SVN on platform Other
Assigned to: Dimitri van Heesch

Original attachment names and IDs:

On 2004-10-08 11:20:44 +0000, swayf wrote:

call of a static member function in C++ is not recognized
if "using namespace" used or if it was called inside the namespace.

In the example 1 code below the call in main() to MyClass::fun()
is not found by doxygen 1.3.9. In this case this call in main is not recognized,
of course the "referency by" section for MyClass::fun is empty.
There is no problem if I write explicity namespace for the call.

Example 1

namespace TEST
{

class MyClass
{
public:
/**
* Do nothing.
* @return 0.
*/
static int fun () { return 0; };
};

}

using namespace TEST;

/**

  • Main function.
    */
    int main ()
    {
    return MyClass::fun();
    }


namespace TEST
{

class MyClass
{
public:
/**
* Do nothing.
* @return 0.
*/
static int fun () { return 0; };
};

}

using namespace TEST;

/**

  • Main function.
    */
    int main ()
    {
    return TEST::MyClass::fun(); //in this way it works
    }

if we have in this namespace "stand-alone" function with the same name
to we get link to this separate function, however we use class name
explicity in this call (example 2)


namespace TEST
{
int fun (int par) { return par; }; //this function will be
//linked with call in main

class MyClass
{
public:
/**
* Do nothing.
* @return 0.
*/
static int fun () { return 0; };
};

}

using namespace TEST;

/**

  • Main function.
    */
    int main ()
    {
    return MyClass::fun();
    }

On 2004-10-13 18:19:52 +0000, Dimitri van Heesch wrote:

Should work in 1.3.9.1. Can you confirm?

On 2004-10-14 10:19:21 +0000, swayf wrote:

Example 1 works with 1.3.9.1.
Example 2 not.

Here is a variant of example 1, that is doesn't work with 1.3.9.1

Example 3

namespace TEST
{

class MyClass
{
public:
/**
* Do nothing.
* @return par.
*/
static int fun(int par)
{ return par; };
};
namespace TEST2
{
class MyClass2
{
public:
static int fun2()
{return 0;}
};
}

}

using namespace TEST;
using namespace TEST::TEST2;

/**

  • Main function.
    /
    int _tmain(int argc, _TCHAR
    argv[])
    {
    int i = MyClass2::fun2(); // here the link is generated properly
    return MyClass::fun(i); // here not
    }

if I change "using namespace" to another order, in this case MyClass::fun(i)
will be recognized and MyClass2::fun2() not.

On 2005-02-10 12:35:21 +0000, pewetede wrote:

The same problem occurs when documenting java code: statically called functions
do not have a filled 'referenced by' section

myFunc1 {
double x = myClass.myFunc2 => empty 'referenced by' section for myFunc2
}

myFunc1 {
myClass obj = new myClass()
double x = obj.myFunc2 => filled 'referenced by' section for myFunc2
}

On 2007-10-15 19:40:38 +0000, Dimitri van Heesch wrote:

This bug's version was set to "latest". Since this is a moving target, I changed it to 1.5.3-SVN. If you believe this has already been fixed, then please change the status accordingly.

On 2013-08-25 16:26:49 +0000, albert wrote:

I looked with version 1.8.5 to the 3 original examples.
Examples 1 and 2 are OK

Example 3 still has a problem. When the code is as specified in the Source code the MyClass2::fun2 is not hyper linked; when interchanging the 2 using namespace statements MyClass2::fun2 is hyper linked. MyClass::fun is hyper linked in both cases. (same accounts for the references in tmain).

On 2013-08-25 16:28:37 +0000, albert wrote:

Created attachment 253064
Used example3 and config file

Example3 plus configuration file

On 2013-09-09 09:18:17 +0000, Dimitri van Heesch wrote:

Confirmed. Should be fixed in the next GIT update.

On 2013-12-24 18:59:39 +0000, Dimitri van Heesch wrote:

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

@doxygen doxygen closed this Jul 1, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.