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 789168 - Increasing access of inherited C++ members with 'using...' is not recognized by Doxygen
Increasing access of inherited C++ members with 'using...' is not recognized ...
Status: RESOLVED OBSOLETE
Product: doxygen
Classification: Other
Component: general
1.8.13
Other Windows
: Normal normal
: ---
Assigned To: Dimitri van Heesch
Dimitri van Heesch
[moved_to_github]
Depends on:
Blocks:
 
 
Reported: 2017-10-18 17:45 UTC by the.crazed.cat.herder
Modified: 2018-07-30 10:53 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description the.crazed.cat.herder 2017-10-18 17:45:33 UTC
Consider the following C++ code:

class BaseClass
{
public:

	BaseClass() { };
	virtual ~BaseClass() {};

protected:

	void SomeFunc() {};

};


class DerivedClass1 : public BaseClass
{
public:

	DerivedClass1() {};
	virtual ~DerivedClass1() {};

	using BaseClass::SomeFunc;

};


class DerivedClass2 : protected BaseClass
{
public:

	DerivedClass2() {};
	virtual ~DerivedClass2() {};

	using BaseClass::SomeFunc;

};

In both these sample derived classes, BaseClass::SomeFunc has had it's access changed to 'public' by employing the keyword 'using'. This is true regardless of the base class access level (public in DerivedClass1, protected in DerivedClass2), and regardless of the member access level originally defined in BaseClass (protected, in this example.)

Unfortunately, Doxygen insists that SomeFunc is still protected in both example derived classes. This is incorrect - employing 'using' in this manner to increase the access of the inherited BaseClass::SomeFunc is perfectly valid C++ (as of C++11, I believe), and VC++ recognizes this; it is, in fact, publicly accessible in both derived classes.

See http://en.cppreference.com/w/cpp/language/using_declaration for more information.
Comment 1 Dimitri van Heesch 2017-10-29 10:48:09 UTC
Confirmed. Should be fixed in the next GIT update.
Comment 2 the.crazed.cat.herder 2017-10-31 01:29:06 UTC
Thanks very much!

Soo... errr.... I don't suppose I could convince you to release an updated set of Windows binaries....?

:)
Comment 3 Vladimír Vondruš 2017-11-19 12:09:39 UTC
Hi,

was not sure what's the proper place where to report this, so I'm commenting here. 

The change at https://github.com/doxygen/doxygen/commit/9468ede259153cf79eb8d61635389744e9a2ee7d that aims to fix this bug broke XML output for me on classes that move public overloaded member to private section. Here's a minimal repro case:

    /** @brief Foo */
    struct Foo {
        /** @brief Do a thing */
        void thing();

        /** @brief Do a thing with int */
        void thing(int);
    };

    /** @brief Bar */
    struct Bar: Foo {
        private: using Foo::thing;
    };

And here's a minimal Doxyfile:

    INPUT                  = class.h
    QUIET                  = YES
    GENERATE_HTML          = NO
    GENERATE_LATEX         = NO
    GENERATE_XML           = YES

For me, Doxygen crashes when producing the XML output, leaving half-written or empty XML files. Doesn't happen when generating just the HTML or LaTeX output; doesn't happen when making private things public, doesn't happen when there's just one non-overloaded function. Reverting the above commit makes everything working again.

Hope this is enough info. Thank you for looking into this.
Comment 4 Dimitri van Heesch 2017-11-19 14:23:25 UTC
Thanks for the report. I've made this commit to avoid the crash:

https://github.com/doxygen/doxygen/commit/1a1fdbed64de6ce01959b2e4d0988be823fb6bad

Let me know if works for you.
Comment 5 Vladimír Vondruš 2017-11-19 14:42:19 UTC
Yes, this works for me. Thanks for the fast reaction!
Comment 6 Dimitri van Heesch 2017-12-25 18:44:02 UTC
This bug was previously marked ASSIGNED, which means it should be fixed in
doxygen version 1.8.14. 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 (preferably in the form of a self-contained example).
Comment 7 the.crazed.cat.herder 2017-12-27 22:09:53 UTC
Hi, Dimitri -

The fix works for the case I gave as an example, but seems to be failing on a more complex case from the same source code library. I'm currently trying to distill it to as simple an example as possible. Would it be appropriate to continue here, or should I open a new bug report? As I say, the fix DOES work for the original code sample.

And thanks for your work.
Comment 8 the.crazed.cat.herder 2017-12-29 18:26:38 UTC
Hi, Dimitri -

Consider the following example:


class BaseClass
{
public:

	BaseClass() { };
	virtual ~BaseClass() {};

	void SomePublicFunc() {};

protected:

	void SomeProtectedFunc() {};

};


class FirstGenDescendant : public BaseClass
{
public:

	FirstGenDescendant() {};
	virtual ~FirstGenDescendant() {};

	using BaseClass::SomeProtectedFunc;

};


class SecondGenDescendant : protected FirstGenDescendant
{
public:

	SecondGenDescendant() {};
	virtual ~SecondGenDescendant() {};

	using FirstGenDescendant::SomePublicFunc;
	using FirstGenDescendant::SomeProtectedFunc;


};

Ver. 1.8.14 treats the first descendant class properly - SomProtectedFunc gets listed as public. But the protected class inheritance in SecondGenDescendant seems to break things - SomePublicFunc and SomeProtectedFunc should both be listed as public in SecondGenDescendant, by dint of the 'using' declarations.

(And FWIW, the latest version of Visual Studio's Intellisense also gags on this. The compiler treats it properly, but Intellisense and ClassView both get it wrong. So you aren't alone.)
Comment 9 André Klapper 2018-07-30 10:53:52 UTC
As discussed in https://github.com/doxygen/doxygen/pull/734 , Doxygen has moved its issue tracking to 

   https://github.com/doxygen/doxygen/issues

All Doxygen tickets in GNOME Bugzilla have been migrated to Github. You can subscribe and participate in the new ticket in Github. You can find the corresponding Github ticket by searching for its Bugzilla ID (number) in Github.

Hence I am closing this GNOME Bugzilla ticket.
Please use the corresponding ticket in Github instead. Thanks a lot!