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 333931 - support for smart pointers (dereference operator in template)
support for smart pointers (dereference operator in template)
Status: RESOLVED FIXED
Product: doxygen
Classification: Other
Component: build
1.4.x
Other Linux
: Normal enhancement
: ---
Assigned To: Dimitri van Heesch
Dimitri van Heesch
: 333997 334010 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-03-08 17:40 UTC by Rob Leathley
Modified: 2012-07-22 16:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to fix this bug (1.09 KB, patch)
2011-03-09 16:32 UTC, Robert Nelson
none Details | Review

Description Rob Leathley 2006-03-08 17:40:28 UTC
Doxygen does not appear to understand dereference operators (->) in a templatised class as is typically used in smart pointers.  I have encounterd the problem using boost::shared_ptr, but the following code illustrates the problem:

template <class T> class SmartPointer {
  public:
  T *pointer;
  T *operator->() const {return pointer};
};

class A {
  public:
  void do() {};
};

class B {
  public:
  void do() {};
};

class C {
  public:
  A *a;
  SmartPointer<B> b;
  void do() {
    a->do();
    b->do();
  };
};

The doxygen output shows that a->do() is a reference to A::do(), but b->do() is unrecognised.  This means that member function "Referenced by" lists are incomplete.
Comment 1 Rob Leathley 2006-03-09 12:13:59 UTC
*** Bug 333997 has been marked as a duplicate of this bug. ***
Comment 2 Rob Leathley 2006-03-09 12:14:42 UTC
*** Bug 334010 has been marked as a duplicate of this bug. ***
Comment 3 Rob Leathley 2006-03-10 12:18:58 UTC
The collaboration diagram of class C appears correct with v1.4.6 in that SmartPointer<B> is associated with B::do().  However the call graph for C::do() is missing B::do(); and B:do() is missing 'referenced by' C::do().
Comment 4 Dimitri van Heesch 2006-03-12 17:13:39 UTC
Doxygen does not understand operator overloading at the moment.
Comment 5 Rob Leathley 2006-03-13 09:53:00 UTC
Do you know roughly when operator overloading may be supported?  I notice it is not on the wishlist, but I imagine it will benefit many people.  Thanks.
Comment 6 Kevin McBride 2006-03-21 07:10:46 UTC
Adding HELPWANTED keyword, as Dimitri has not set the ASSIGNED status.

Rob: It will be implemented when some one chances by to fix it.  Also, since doxygen is open source, you can also modify the source code yourself to support operator overloading.  I think there are instructions in the doxygen manual on how to implement new stuff into the preprocessor.
Comment 7 Robert Nelson 2011-03-09 16:32:46 UTC
Created attachment 183002 [details] [review]
Patch to fix this bug

This fixes this bug by adding support for operator ->() overloads.

However smart pointers still don't work properly if they are declared using a typedef.

CSmartPointer<CTest> pTest;

typedef CSmartPointer<CTest> CTestPtr;

CTestPtr pTest2;

pTest->Func();    // Works

pTest2->Func();	// Doesn't work.
Comment 8 Dimitri van Heesch 2012-07-22 16:29:54 UTC
In the meantime smart-pointer support has been added, so the original example works as expected.

Feel free to reopen this bug report if you find a case where it does not work.