After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 154880 - if "using namespace" used, call of a static member function in C++ is not recognized or recognized wrong
if "using namespace" used, call of a static member function in C++ is not rec...
Status: RESOLVED FIXED
Product: doxygen
Classification: Other
Component: build
1.5.3-SVN
Other Windows
: Normal normal
: ---
Assigned To: Dimitri van Heesch
Dimitri van Heesch
Depends on:
Blocks:
 
 
Reported: 2004-10-08 11:20 UTC by swayf
Modified: 2013-12-24 18:59 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Used example3 and config file (13.28 KB, application/octet-stream)
2013-08-25 16:28 UTC, albert
Details

Description swayf 2004-10-08 11:20:44 UTC
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();
}
-----------------------------------------------------
Comment 1 Dimitri van Heesch 2004-10-13 18:19:52 UTC
Should work in 1.3.9.1. Can you confirm?
Comment 2 swayf 2004-10-14 10:19:21 UTC
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.
Comment 3 pewetede 2005-02-10 12:35:21 UTC
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
}
Comment 4 Dimitri van Heesch 2007-10-15 19:40:38 UTC
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.
Comment 5 albert 2013-08-25 16:26:49 UTC
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).
Comment 6 albert 2013-08-25 16:28:37 UTC
Created attachment 253064 [details]
Used example3 and config file

Example3 plus configuration file
Comment 7 Dimitri van Heesch 2013-09-09 09:18:17 UTC
Confirmed. Should be fixed in the next GIT update.
Comment 8 Dimitri van Heesch 2013-12-24 18:59:39 UTC
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).