Example:
// can't forward declare with class Foo::Bar
// actual class
class Foo
{
public:
class Bar // or enum Bar
{
}
};
I accept that this is not allowed under the current C++ standards, but I couldn't come up with a good reason of not allowing it though, especially with C++0x, we're now able to forward declare enums. I would imagine an argument against it would be if we foward declare nested class which turns out to be private, it wouldn't be allowed. But this wouldn't be too different to say forward declaring a class in a namespace, and then declaring it a nested class of an outer class. The compiler would simply give an error (perhaps an error message along the line of previous declaration doesn't match this declaration).
So why is it really not allowed then?
In other words (by James McNellis), "why is class Foo::Bar; without providing a definition for Foo or Bar not allowed?"
** Given that the C++ standards committee recognised the benefit of using forward declarations to reduce dependencies and compile time by introducing forward declaration of enums in C++0x, surely this is part of the same thing isn't it?