I am able to compile this using -std=c++0x (not even -std=gnu++0x): #include <iostream> int main() { int test[] = {1,2,3}; std::cout << test[0] << test[1] << test[2]; test = {4,5,6}; std::cout << test[0] << test[1] << test[2] << std::endl; }
it compiles without warnings (-Wall -Wextra -pedantic) and prints 123456. Tested on GCC 4.4.3 and GCC 4.5.1-pre9999 The C++0x final draft (N3092) says, under 5.17/9 [expr.ass] A braced-init-list may appear on the right-hand side of an assignment to a scalar [...] an assignment defined by a user-defined assignment operator [..] The standard does not allow assignment from a braced-init-list to arrays (and if was allowed, then, logically, assignment of arrays to arrays would be allowed as well) -- Summary: incorrectly allows assignment to arrays from braced- init-list (c++0x) Product: gcc Version: 4.5.1 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: cubbi at cubbi dot org GCC host triplet: x86_64-pc-linux-gnu-4.5.1-pre9999 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44449