Wrong completion with namespaces.
Exact example code:
#include"c.h" // In that file: namespace z{class t{int y;};}
using z::t;
//using namespace z;
int main(){
t v;
v. // Bug is here
return 0;}
If you uncomment line "//using namespace z;" the Code completion will work perfect.
But here we see that class "t" is already visible by "using z::t;".
Strange, but if you put the contents of "c.h" instead of "#include", this will work fine again.
In my example, code completion don't shows "y:int" in pop-up.
Platform: LinuxMint x64, CodeBlocks 13.12, CodeCompletion v1.0, compiler: gcc.
If I can remember, C::B's parser don't handle the "using z::t". I mean the parser just skip the line and do nothing.
But we do handle "using namespace z;" statement when we prompt a suggestion list(codecompletion)
Hi, I've attached a patch for this bug. It changes CC's behavior so that instead of skipping the pattern "using A::B", it will recognize it and parse it similarly to "using namespace A".
Last edit: jat1 2015-05-23
Thanks, jat1, I will look into your patch.
The patch works fine! Thanks.
Now, I can't connect to SF through svn, so I can't commit this patch.
I can use proxy to access to SF's web page.
I added some comments in the patch, see attachment.
I can access to svn now, so the patch is in trunk now. Thanks for the contribution.
The added comments look good, thanks. Do you think it would be better to change:
to this:
so it is clearer why m_Str contains "A" for case (1) and (3), and "A::B" for case (2)? In other words, m_Str must end with a namespace for CC to work.
Thanks for the suggestion, done in the trunk.