[comp.lang.c++] Scope of class name bug fix for 1.1

bs@alice.UUCP (02/02/87)

I had the following bug report mailed to me. Since I don't seem to be able to
get the reply directly back and since the problem and its solution might be
of more general interest I'll post it:

	Is this a bug? Or is the error message right: I cannot declare
	forward references for local classes in this release?

	I can define a class local to a class, but I cannot declare a class
	local to a class as forward. How do I get the following to work?
	I don't want bar to be visible, but I want pointers to bar before
	I declare bar. Thanks.

	class foo {

	class bar;

		class needs_bar {
		public:
			bar *k;
		};

		class bar {
		public:
			needs_bar i;
		};

		bar j;
	public:
	};

	foo foo_bar;

	main() {
	}

	output from 1.1:

	"test.c", line 16: sorry, not implemented: local class bar and global class bar 

It ought to work. I get a syntax error for the forward declaration ``class bar;''
inside class foo. When I put ``class bar;'' outside it does work. To get the
(modified) example to work on a release 1.1 simply grep for that error message
(you'll find in norm.c or norm2.c) and remove it. Sorry.