http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48911
Summary: [C++0x]An error that a valid array subscript Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: sscr...@gmail.com Source: int main() { { constexpr int array[1] = {0}; constexpr int i = array[0]; // OK. } { constexpr int array[1] = {}; constexpr int i = array[0]; // error: array subscript out of bound. Why? } } Compile errors: a.cpp: In function 'int main()': a.cpp:5:17: warning: unused variable 'i' [-Wunused-variable] a.cpp:9:28: error: array subscript out of bound a.cpp:9:17: warning: unused variable 'i' [-Wunused-variable] Access to array[0] is valid. But, compiler says "that's an error."