Bug #18544 2012-03-27 04:23

hooluupog

Code Completion fails to show tips .

I am using Code::Blocks nightly build 7789(update from stable build 10.05).  FYI, mingw gcc -version gcc (tdm-1) 4.6.1,gdb 7.3
The code completion always fails showing tips.
 List some cases as follows:
Case 1:
//--------------MyException.h-----------------
#include <string>
class MyException
{
    public:
        virtual std::string getwhat() = 0;
};

class MyDivideZero : public MyException{
    public:
        std::string getwhat()
        {
            return "Divide By Zero.";
        }
};

class MyTooLarge : public MyException{
    public:
        std::string getwhat()
        {
            return "Too Large Number.";
        }
};
//-------------------------main.cpp-----------------
#include "MyException.h"
#include <iostream>
using namespace std;
 int main(){
        try{
              cout<<"It's a test."<<endl;
        }catch(MyException& e)
        {
            cout<<e.getwhat()<<"\n";                 //       code completion fails showing getwhat() method.  After i write 'e.' ,it shows nothing.
        }
    }
Case 2:
//-----------------------StrInt.h-----------------
#include <iostream>
#include <string>
class StrInt{
        std::string _num;
    public:
        StrInt(const std::string& a = "0");
};
//--------------------StrInt.cpp-----------------
#include "StrInt.h"
StrInt::StrInt(const std::string& a) : _num(a)
{
    if (a.length()==0) ;                   //      code completion fails showing length() method. After i write 'e.' ,it shows nothing.
}
Case 3:
#include <string>
#include <map>
using namespace std;

int main()
{
    map<int,string> mps;
    mps.begin()->second.append("hello");//     code completion fails showing second member. After i write 'begin()->' ,it shows nothing. After write 'second.' ,it shows nothing.
    return 0;
}
Category
Plugin::CodeCompletion
Group
Platform:Windows
Status
Open
Close date
 
Assigned to
ollydbg
hooluupog 2012-03-27 05:01

And also some error tips. for example:

I defined a class named StrInt. A member method named mul.

std::string StrInt::mul(const std::string& a, const std::string& b)

{

std::string s(a.length()+b.length(),'0');

}

Now when putting cusor on 'a',it shows "conststring & StrInt::mul::a", the same with 'b'. The correct tip info should be"const std::string& a". This error tip leads to object 'a' fail to show its length() method after inputting 'a.' Maybe this is concerned with Case 2 as stated above.