[Bug c++/55020] New: 4.7.2 allow array init wih non-const argument

marktbremen45 at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Oct 22 12:28:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55020

             Bug #: 55020
           Summary: 4.7.2 allow array init wih non-const argument
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: marktbremen45@gmail.com


Created attachment 28506
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28506
g++ -v --version > e.lis 2>&1

int main() {
   int sz = 13; // not a constant expression
   int arr[sz];          // should not compile, but does so
}

compiles, but should not. 
Array even works at runtime  with int arg; cin >> arg; int arr[arg]; !

System: Suse Linux 12.2

g++ -v yields:

"
Es werden eingebaute Spezifikationen verwendet.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/i686-pc-linux-gnu/4.7.2/lto-wrapper
Ziel: i686-pc-linux-gnu
Konfiguriert mit: ../gcc-4.7.2/configure --enable-languages=c++
Thread-Modell: posix
gcc-Version 4.7.2 (GCC) 
"
g++ -v --version : see attachment:



More information about the Gcc-bugs mailing list