Possible scoping bug?

Niall Smart njs3@doc.ic.ac.uk
Sun May 24 11:13:00 GMT 1998


Hi,

The following code fails to compile; but I'm not sure if it should:

     1	struct foo {
     2	        int     x;      
     3	};
     4	
     5	int main()
     6	{
     7	        foo*    foo;    
     8	        
     9	        foo = (foo*) 0;
    10	}

[njs3@cnet0000 ~]$ g++ --version; g++ foo.cc
egcs-2.91.29
foo.cc: In function `int main()':
foo.cc:9: parse error before `)'

Changing line 9 to

	foo = (::foo*) 0;

or
	foo = (struct foo*) 0; 

makes it work.  Is this necessary?

Niall



More information about the Gcc-bugs mailing list