Thread: gcc bug ?
View Single Post
gcc bug ?
Old
  (#1)
koraX
Member
 
koraX's Avatar
 
Status: Offline
Posts: 145
Join Date: Jan 2004
Location: Slovak Republic
Default gcc bug ? - 01-09-2004

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


kXBot
koraX's utils
- see my homepage for other projects (OpenGL CSG Editor, FAT16 Sim, NNetwork Sim, ...)

Last edited by koraX; 01-09-2004 at 10:44..
  
Reply With Quote