If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

I'm afraid a reference won't work, either. Pretty much the same reason. As you know a reference variable has to be initialized with an existing object.
So your constructor would go into an infinite loop causing some sort of stack overflow...
Haven't tried it, but would surprise me if a ref would work. Probably Danny can shed some light on it from a C++ - standard perspective?

You're right. A reference to A used as a member in class A is illegal. The problem is not recursion, but a chicken and the egg issue: conceptually, reference data members must be initialized before the object's constructor has run. In other words, they must be initialized in a member initialization list. However, the initializer of rhs must be a valid A object, i.e., *this, and the expression *this is considered a valid object only once the constructor has finished executing.
Because of this, the code as is will not compile. Making rhs a reference to const might make it compile but the code will still have undefined behavior because the program is forced to initialize rhs with an object that hasn't been fully constructed: