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 145294 - Boolean expression as template argument confuses doxygen
Boolean expression as template argument confuses doxygen
Status: RESOLVED FIXED
Product: doxygen
Classification: Other
Component: general
1.3.x
Other All
: Normal major
: ---
Assigned To: Dimitri van Heesch
Dimitri van Heesch
Depends on:
Blocks:
 
 
Reported: 2004-07-02 07:39 UTC by Wu Yongwei
Modified: 2013-05-19 12:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
other variations for what seems to be the same bug (1.10 KB, text/plain)
2007-07-30 15:43 UTC, zaffanella
Details

Description Wu Yongwei 2004-07-02 07:39:39 UTC
Try running doxygen on the following C++ file:

------------------------------------------------------------------
/** Test Class 1. */
template <class _Host, bool _RealLock>
class_level_lock {
public:
	/** Lock. */
	void lock();
	/** Unlock. */
	void unlock();
};

/** Test Class 2. */
template <int _ClientId>
class Client : public class_level_lock<Client, (_ClientId < 0)> {
public:
	/** A test member function. */
	void test();
};
------------------------------------------------------------------

No class documentation will be generated at all.  Changing "(_ClientId < 0)" to 
something like "true" will make something appear, but still not quite right.  
Something non-existent like "Client<Client, true>" appears in the inheritance 
diagram.  Not only inheritance, but also just using "class_level_lock<Client, 
(_ClientId < 0)>" will cause miscellaneous problems.
Comment 1 Dimitri van Heesch 2004-07-11 13:57:29 UTC
This is a known issue. At several places in the code it is assumed that in the
argument list of a template the number of <'s and >'s matches. I've tried to
fixed this before, but it is not easy at all. As a workaround you could use:

------------------------------------------------------------------------------
/** Test Class 1. */
template <template<int> class _Host, bool _RealLock>
class class_level_lock {
public:
        /** Lock. */
        void lock();
        /** Unlock. */
        void unlock();
};

#define IS_REAL_LOCK(id) (id<0)

/** Test Class 2. */
template <int _ClientId>
class Client : public class_level_lock<Client, IS_REAL_LOCK(_ClientId)> {
public:
        /** A test member function. */
        void test();
};
------------------------------------------------------------------------------

Note that I also had to adjust the first template argument of the lock before my
compiler (gcc 3.3) would accept it as valid C++!
Comment 2 Wu Yongwei 2004-07-12 02:31:46 UTC
Sorry that I did not make it right when adapting the test case. In fact, apart 
from the omission of keywork `class' on l. 3, l. 13 is intended to be

class Client : public class_level_lock<Client<_ClientId>, (_ClientId < 0)> {

My fault not having tested it.
Comment 3 Dimitri van Heesch 2005-10-04 18:39:19 UTC
This bug was resolved to status "FIXED" as part of a group change. Please verify
that this bug is indeed fixed in doxygen version 1.4.5 (or later). If not then
please reopen the bug, so it stays on my radar.
Comment 4 Wu Yongwei 2005-10-08 08:09:41 UTC
Really fixed in 1.4.5?  My test with doxygen-1.4.5.windows.bin.zip did not show 
so.  I use the same old test file:

/**
 * @file test.cpp
 */

/** Test Class 1. */
template <class _Host, bool _RealLock>
class class_level_lock {
public:
    /** Lock. */
    void lock();
    /** Unlock. */
    void unlock();
};

/** Test Class 2. */
template <int _ClientId>
class Client : public class_level_lock<Client<_ClientId>, (_ClientId < 0)> {
public:
    /** A test member function. */
    void test();
};

No diagrams are output, until I change "(_ClientId < 0)" to something 
like "(_ClientId != 0)" or "true", i.e., remove the less-than or greater-than 
character.
Comment 5 Dimitri van Heesch 2005-10-08 15:32:41 UTC
I assumed it was fixed since the status was "assigned". You are right that it is
not. I have a fix now, so it should appear in the next CVS update.
Comment 6 Dimitri van Heesch 2005-12-30 17:47:36 UTC
This bug had the status ASSIGNED (which meant it was fixed, but not officially released), so now doxygen release 1.4.6 is out I've given it the status FIXED. 

Nevertheless, I would like to ask you to verify that this bug is indeed fixed in release 1.4.6. If not, then please reopen the bug.
Comment 7 Wu Yongwei 2006-04-17 12:45:27 UTC
Hi Dimitri,

I just tested it and regretted to inform you that the bug is still there.

Since I changed job, I cannot access my old e-mail address and it seems I cannot change the status of the bug now.
Comment 8 Dimitri van Heesch 2006-04-17 19:06:42 UTC
Reopen, as per request of the submitter.
Comment 9 zaffanella 2007-07-30 15:42:14 UTC
Please find attached a simple test showing what seems to be a variant of the bug described here above.

The test uses several Boolean operators in expressions occurring in template parameter lists (which is often the case when using template meta-programming techniques): besides the case of relational operators < and > being (mis-) interpreted as unbalanced angled parentheses, it shows a problem with the use of balanced (round, i.e., not angled) parentheses.
Comment 10 zaffanella 2007-07-30 15:43:49 UTC
Created attachment 92720 [details]
other variations for what seems to be the same bug
Comment 11 albert 2013-04-28 09:10:58 UTC
I've tested the problem from Wu Yongwei with version 1.4.5 and with version 1.8.3.1 and with version 1.4.5 I don't see any graphs in "Client< _ClientId > Class Template Reference" whilst these are present in version 1.8.3.1

In respect to the problem as mentioned by zaffanella, the ko2 variable still does not show up, so this bug is still present, I don't see any error message regarding it though.
Comment 12 Dimitri van Heesch 2013-05-10 13:51:48 UTC
Confirmed. The problem with ko2 should be fixed in the next subversion update.
Comment 13 Dimitri van Heesch 2013-05-19 12:36:32 UTC
This bug was previously marked ASSIGNED, which means it should be fixed in
doxygen version 1.8.4. 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.