3 ms·
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 compiler
by pbsd 13y ago
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.
- knome 13y agoIt 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.