A similar question got asked here, but didn't get a proper answer.
Is the following legal?
struct B;
struct A
{
A(B& b) : b(b)
{
}
B& b;
};
struct B
{
B(A& a) : a(a)
{
}
A& a;
};
struct C
{
C() : a(b), b(a)
{
}
A a;
B b;
};
I wonder if it falls under 3.8 (6) (C++ 2003)
... before the lifetime of an object has started but after the storage which the object will occupy has been allocated or, after the lifetime of an object has ended and before the storage which the object occupied is reused or released, any lvalue which refers to the original object may be used but only in limited ways. Such an lvalue refers to allocated storage (3.7.3.2), and using the properties of the lvalue which do not depend on its value is well-defined.