News for hackers. Stuff that matters.
Re:How to abuse a C++ compiler? by pbsd on Thursday March 20, 2014 @12:41PM (#7436717)
I don't see how that could not be a compiler error. The case b = 10 is more interesting because, as far as I can tell, it shows the differences between compilers that do two-phase lookup correctly and those that don't.

This seems to be a rare case where GCC is in the right, but I'd have to double-check the standard to be sure.

Re:How to abuse a C++ compiler? by knome on Thursday March 20, 2014 @10:28PM (#7440303)
It was pointed out to me after I joined #llvm when considering reporting this that using the value of "b", which is defined after "a" in the class before it has been initialized is, I suppose obviously in retrospect, undefined behavior.

In effect, I was subverting the undefined behavior associated with expanding a set of infinitely deep template instantiations by accessing a variable that was as yet undefined at the point of access.

So, my initial retractions stand, and this compiler behavior will remain appropriately undefined.