User forums > Using Code::Blocks

small bug of code complete(friend operator)

(1/1)

snija:
I`ve found a small bug about code completion.
Code completion fails when you define a friend operator in the class.

--- Code: ---#include <iostream>
/* class A*/
class clsA
{
    int m_iclsA;
};

/* class B*/
class clsB
{
    int m_iclsB;
    public:
    clsB(int x=0){m_iclsB=x;}
    ~clsB(){;}
    void value(){std::cout << "The value is "<< m_iclsB << std::endl;}
    friend clsB operator + (const clsB & para0,const clsB & para1){
        clsB temp;
        temp = para0.m_iclsB + para1.m_iclsB;
        return temp;
    }
};

/* class C*/
class clsC
{
    int m_iclsC;
};
/**/

int main()
{
    clsB obB0(0),obB1(1),obB2(2);
    obB0.value();
    obB0 = obB1 + obB2;
    obB0.value();
    std::cout << "Ends" << std::endl;
    return 0;
}

--- End code ---
It could be successfully compiled and run,but clsC does not exist in the symbols.
Also, when you type obB0. and no code completion exists.
After you remove that friend operator definition, everything`s ok.
Please fix this bug,thanks a lot.
Win XP SP2, cb nightly build (several versions up to sep-18).

Navigation

[0] Message Index

Go to full version