very complicated error. Maybe someone here has enough C++ knowledge
problem.cpp
Code:
namespace util {
class CSys
{
public:
CSys(void);
~CSys(void);
int operator() () {return 8;}
};
CSys sys1;
CSys &sys=sys1;
}
util::CSys::CSys()
{
}
util::CSys::~CSys()
{
}
void this_cause_error()
{
util::sys(); // error in gcc : "error, cannot be used as a fuction"
}
using namespace util;
int main(int /* argc */, char* /* argv[] */)
{
// these 5 lines will call same operator
util::sys.operator() (); // OK
sys.operator() (); // OK
sys(); // OK
this_cause_error();
util::sys(); // error in gcc : "error, cannot be used as a fuction"
}
in Visual C++ .NET, everything is fine, but gcc won't even compile, because of util::sys();
Seems like specifying namespace is causing him trouble, because other 2 lines compile without error
I'm using gcc 3.3.4.
Am I doing something wrong or gcc has a bug ?
EDIT : Well newest gcc is 3.4.1, so maybe I should upgrade, but I just want to know if problem is in gcc or in my code