On 20140913, at 9:52 PM, John Zwinck <jzwinck@gmail.com> wrote:

I would appreciate any thoughts on this, and hope I have come to the right place to discuss it.

You have certainly come to the right place.

The problem cant be solved in general, because member references generate a case where mutual recursion is possible:

struct s {
int & a = b;
int & b = a;

Globals allow similar evil:

// a.cpp
extern int & b;
int & a = b;

// b.cpp
extern int & a;
int & b = a;

Any solid rule to forbidding self-initialized references would need to have exemptions for such cases, which would be a serious devaluation. It comes down to QOI.

However, I think there is a problem that such programs are well-formed but only produce UB at runtime. The compiler should be allowed to complain that the reference is initialized without a referent object.

So, a good specification would be that a program is ill-formed but no diagnosis is required, if a reference initializer never refers to an object.