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 621780 - Declaring a new class as the result type of a function confuses doxygen
Declaring a new class as the result type of a function confuses doxygen
Status: RESOLVED OBSOLETE
Product: doxygen
Classification: Other
Component: general
1.7.1
Other Windows
: Normal normal
: ---
Assigned To: Dimitri van Heesch
Dimitri van Heesch
[moved_to_github]
Depends on:
Blocks:
 
 
Reported: 2010-06-16 13:22 UTC by Timothy Madden
Modified: 2018-07-30 10:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Sample source code to illustrate the problem (138 bytes, text/plain)
2010-06-16 13:22 UTC, Timothy Madden
Details
Generated documentation page (6.86 KB, text/html)
2010-06-16 13:24 UTC, Timothy Madden
Details
example C code to reproduce the problem (143 bytes, text/plain)
2010-06-22 13:30 UTC, Timothy Madden
Details
Doxyfile for v 1.7.1 (68.83 KB, application/octet-stream)
2010-06-25 12:01 UTC, Timothy Madden
Details
.cpp source file (136 bytes, text/plain)
2010-06-25 12:02 UTC, Timothy Madden
Details
Generated documentation (67.38 KB, application/octetstream)
2010-06-25 12:02 UTC, Timothy Madden
Details

Description Timothy Madden 2010-06-16 13:22:39 UTC
Created attachment 163820 [details]
Sample source code to illustrate the problem

When I declare a new class as the result type of a function, doxygen only sees the class and it treats content of the following function body as global-level declarations.
Comment 1 Timothy Madden 2010-06-16 13:24:44 UTC
Created attachment 163821 [details]
Generated documentation page
Comment 2 Dimitri van Heesch 2010-06-17 12:54:45 UTC
Hi Timothy,

This doesn't look like valid C++ to me, gcc seems to agree and says:

> gcc -c test.cpp 
test.cpp:6: error: new types may not be defined in a return type
test.cpp:6: note: (perhaps a semicolon is missing after the definition of ‘Coord’)

Why not use the following?
--------------------
struct Coord
{
  int a;
  float f;
};
Coord GetLastCoord()
{
  Coord c;

  c.a = 0;
  c.f = 2.7f;

  return c;
}
----------------------
Comment 3 Timothy Madden 2010-06-22 13:30:45 UTC
Created attachment 164308 [details]
example C code to reproduce the problem

C allows declaring a function with a new declared type as the function return type.
Also Visual Studio allows this in C++
Comment 4 Timothy Madden 2010-06-22 13:34:16 UTC
This is valid C code, though, as the 2003 C++ standard says (C1.6 Clause 8).

The C standard only says "A function declarator shall not specify a return type that is a function type or an array type."

So never mind my .cpp extension, this is C code (I made a new attachment), and gcc -c FuncStruct.c compiles successfully. 

So maybe this could still be fixed (for both C and C++ if possible) ?



In C++ they say they removed the feature because C++ relies on name equivalence, while C relies on structural equivalence. Despite that, Microsoft Visual Studio compiles such code in C++ without a problem or a warning.
Comment 5 Dimitri van Heesch 2010-06-22 14:29:15 UTC
Fair enough. I'll add this to doxygen's parsing capabilities.
Comment 6 Dimitri van Heesch 2010-06-25 11:49:00 UTC
This bug was previously marked ASSIGNED, which means it should be fixed in
doxygen version 1.7.1. 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.
Comment 7 Timothy Madden 2010-06-25 12:00:49 UTC
Doxygen now sees the structure members as global-level variables (the sample code is C++, but the same behavior happens for both C and C++).

Look for variables in the File Refrence in the attached documentation generated.
Comment 8 Timothy Madden 2010-06-25 12:01:32 UTC
Created attachment 164611 [details]
Doxyfile for v 1.7.1
Comment 9 Timothy Madden 2010-06-25 12:02:02 UTC
Created attachment 164612 [details]
.cpp source file
Comment 10 Timothy Madden 2010-06-25 12:02:39 UTC
Created attachment 164613 [details]
Generated documentation
Comment 11 André Klapper 2018-07-30 10:56:47 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!