this compiles without a warning in VC9 at warning level 4. Why would one NOT consider this a compiler defect?
I saw some posted code with an out of range error on SO that made me wonder. I would expect a compiler to generate a warning (at the highest level at least) for this code #pragma warning(push,4) int main(){ int x[2]; x[2]=0; return 0; } #pragma warning(pop) but it does not. The EDG compiler nicely says: "sourceFile.cpp", line 3: warning: subscript out of range x[2]=0; ^ Actually EDG says bit more more(all of which are expected) "sourceFile.cpp", line 1: warning: unrecognized #pragma #pragma warning(push,4) ^ "sourceFile.cpp", line 4: warning: subscript out of range x[2]=0; ^ "sourceFile.cpp",