User forums > Using Code::Blocks

Symbol Browser trouble with class ctor/dtor definition when namespace is used

(1/2) > >>

Greatwolf:
Hi all,

I've identified a bug in the symbol browser(codecomplete?) plugin. Please let me know if this is the correct section to post or not.

The problem I'm running into is that the C::B plugin is unable to locate the class constructor and destructor definitions when it's used inside a namespace. The following minimal code snippet illustrates the bug:


--- Code: ---namespace foo
{
  class bar
  {
   bar();
   ~bar();
  };
  bar::bar() {}
  bar::~bar() {}
}
--- End code ---

The declaration for bar() and ~bar() is correctly located but when I try to find the implementation, it will tell me it's not found. The scope bar above the editor also does not display correct for these two cases. If you click the caret to be on the line bar::~bar() {} then that scope display will show foo:: and bar(): ~. The expected result for it is foo::bar:: and ~bar().

One more piece of info, if the above test code is change to the following then everything works as expected:


--- Code: ---namespace foo
{
  class bar
  {
   bar();
   ~bar();
  };
}

foo::bar::bar() {}
foo::bar::~bar() {}

--- End code ---


The nightly build used here is 6863. I've submitted a bug report for this already over here. Did anyone else run into this problem also?

Thanks

Greatwolf:
I've attached a picture here to better show the issue. Notice the ctor and dtor declarations are properly found. However, the dtor definition is showing in the wrong scope and the ctor definition is missing altogether! The codecomplete bar at the top is also not showing correctly when the caret is on the ctor definition line.

[attachment deleted by admin]

ollydbg:
sounds like a bug in codecompletion plugin. I will check it :D

ollydbg:
Windows XP, codeblocks trunk 6897, with the test code:

--- Code: ---namespace foo
{
  class bar
  {
   bar();
   ~bar();
  };
  bar::bar() {}
  bar::~bar() {}
}
--- End code ---

Here is the result:

both the declaration and the implementation of constructor are lost.

I will do more check. :D

Greatwolf:

--- Quote from: ollydbg on December 16, 2010, 06:12:35 am ---both the declaration and the implementation of constructor are lost.

I will do more check. :D

--- End quote ---

kewl. thanks for looking into this :)

If it helps to narrow this down, this bug doesn't show up if an anonymous namespace is used. That is to say if the above example is changed to this, everything will work:


--- Code: ---namespace // foo
{
  class bar
  {
   bar();
   ~bar();
  };
  bar::bar() {}
  bar::~bar() {}
}
--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version