This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Possible scoping bug?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]