<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On 2014–09–13, at 9:52 PM, John Zwinck <<a href="mailto:jzwinck@gmail.com">jzwinck@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div style="font-family:arial,sans-serif;font-size:12.8000001907349px">I would appreciate any thoughts on this, and hope I have come to the right place to discuss it.</div></div></blockquote><div><br></div><div>You have certainly come to the right place.</div><div><br></div><div>The problem can’t be solved in general, because member references generate a case where mutual recursion is possible:</div><div><br></div><div><font face="Courier">struct s {</font></div><div><font face="Courier">int & a = b;</font></div><div><font face="Courier">int & b = a;</font></div><div><font face="Courier">};</font></div><div><br></div><div>Globals allow similar evil:</div><div><br></div><div><font face="Courier">// a.cpp</font></div><div><font face="Courier">extern int & b;</font></div><div><font face="Courier">int & a = b;</font></div><div><font face="Courier"><br></font></div><div><font face="Courier">// b.cpp</font></div><div><font face="Courier">extern int & a;</font></div><div><font face="Courier">int & b = a;</font></div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div></div></body></html>