Bug 217180 - Some Eigen types are not recognized by the Duchain when used with namespace declaration
Summary: Some Eigen types are not recognized by the Duchain when used with namespace d...
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (old) (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: HI major
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
: 272465 274429 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-12-03 11:15 UTC by Benjamin Schindler
Modified: 2015-11-14 20:11 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Illustrates the problem with the missing code completion for vec, while the one for vec2 is working (326 bytes, text/x-c++src)
2009-12-03 11:17 UTC, Benjamin Schindler
Details
Main File which shows the problem - needs the Definitions.h file which I'll shortly attach (142 bytes, text/x-c++src)
2009-12-06 13:11 UTC, Benjamin Schindler
Details
Definitions file (112 bytes, text/x-c)
2009-12-06 13:12 UTC, Benjamin Schindler
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Schindler 2009-12-03 11:15:57 UTC
Version:            (using KDE 4.3.4)
Compiler:          gcc-4.3 
OS:                Linux
Installed from:    Gentoo Packages

The test program I'm about to attach shows the problem. 

I have a variable: 
Eigen::Vector3d myVec;

Vector3d is not recognized and therefore I don't get code completion. When I add using namespace Eigen; and declare the Vector3d without Eigen::, it works
Comment 1 Benjamin Schindler 2009-12-03 11:17:34 UTC
Created attachment 38785 [details]
Illustrates the problem with the missing code completion for vec, while the one for vec2 is working
Comment 2 David Nolden 2009-12-05 12:35:06 UTC
It would be very helpful if you could reduce the problem to a minimal example, eg. without includes, and with everything removed that is not related to the problem. You could for example run the file the the preprocessor "cpp" and then reduce the output.
Comment 3 Benjamin Schindler 2009-12-05 13:30:13 UTC
Okay, it's not that simple. 

The simplest  version I could come up with is the following: 

#include <eigen2/Eigen/Core>

int main(int argc, char **argv) {
    Eigen::Vector3d vec;
    return 0;
}

I tried running the preprocessor on the file, but then the problem does not show up. (I also tried to create a dummy matrix class and then a Vector3d typedef for it, but that didn't bring up the issue either. So it must be something specific to Eigen
Comment 4 Aleix Pol 2009-12-05 21:15:37 UTC
I think it would be more helpful if you could move the Vector definition instead of the include file and remove the parts you don't need, so that it's autocontained (we don't need to check in eigen).
Comment 5 Benjamin Schindler 2009-12-06 13:05:52 UTC
I'm not quite sure what you're asking for (Moving the vec declaration or the Vector3d definition?), so I just copied all of eigen and I'll strip it down to a minimal set. 

I just made an interesting discovery that should help a lot when finding the bug: 

I just modified the example above to this: 

int main(int argc, char **argv) {
    Eigen::Vector3d vec;
    Vector3d vec2;
    return 0;
}

And kdevelop recognized vec2 even though I don't have a 'using namespace Eigen' as part of my file. 

So just as a quick shot, it seems that these definitions (may be even all of eigen?) were not recognized to be part of Eigen. 

I then did a quick check and saw that in Matrix.h (which is where Vector3d is defined), there is _no_ namespace Eigen { ... }, but it is in the file which includes matrix.h (need to check, but I think that is Eigen/Core). 

That would also explain why running the preprocessor on the file gets rid of the issue. 

I'll now try to produce a minimal 3-file test to see whether I'm right
Comment 6 Benjamin Schindler 2009-12-06 13:11:50 UTC
Created attachment 38866 [details]
Main File which shows the problem - needs the Definitions.h file which I'll shortly attach
Comment 7 Benjamin Schindler 2009-12-06 13:12:11 UTC
Created attachment 38867 [details]
Definitions file
Comment 8 Benjamin Schindler 2009-12-06 13:13:12 UTC
Yes this is confirmed. 

If a header file is included as

namespace NameSpace {
#include "someFile.h"
}

The definitions of someFile.h are not put into the namespace NameSpace
Comment 9 David Nolden 2009-12-06 13:46:19 UTC
Argh.. that's an enormously ugly thing to do ;-)
Comment 10 Benjamin Schindler 2010-02-11 17:34:58 UTC
Ping... I would give 50 votes for that bug, but I think you got the point :)

Is there any way I can help on this one? For me this bug is one of the most critical to me...
Comment 11 Pierre Willenbrock 2010-04-28 14:57:52 UTC
Still happens in kdevelop 3.10.2/kdevplatform 0.10.2.
Comment 12 Milian Wolff 2011-02-17 15:39:02 UTC
openmpi breaks due to the same limitation in kdevelop...
Comment 13 Aleix Pol 2011-05-05 16:52:53 UTC
*** Bug 272465 has been marked as a duplicate of this bug. ***
Comment 14 Milian Wolff 2011-05-30 15:35:12 UTC
*** Bug 274429 has been marked as a duplicate of this bug. ***
Comment 15 Milian Wolff 2015-11-14 20:11:56 UTC
Hello!

We are working on a new clang-based C/C++ language plugin for KDevelop 5 which
supersedes the old C++ plugin in KDevelop 4. See e.g.:
https://www.kdevelop.org/news/first-beta-release-kdevelop-500-available

Due to a lack of manpower, we cannot fix bugs in the old C++ plugin. We rather
want to supply a good Clang based C++ experience for KDevelop 5 than wasting
our time on the legacy C++ support for KDevelop 4.

With the new clang-based C/C++ language plugin, the bug presented here does not occur. In my testing. For these reasons, I'll close this bug. Please stay tuned for KDevelop 5.

If you think this bug is applicable to Clang/KDevelop 5, please reopen the report and add new information on how to reproduce the bug there.

Sorry for the inconvenience, I hope you understand the reasoning above.

Cheers