In a c++ source file, the following code compiles cleanly: #include <iostream>
using namespace std; void foo(int n) { int myArray[n]; for (int i=0 ; i<n ; i++) myArray[i] = i; } int main() { int z = 1000; foo(z); cout << "returning from foo..." << endl; return 0; } I believe this is incorrect behavior for the C++ standard--compilation should fail on "int myArray[n];" in the function "foo(int n)". -- Summary: Array declaration in functions accepting variable size Product: gcc Version: 3.3.3 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: clippyhater at yahoo dot com CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18894