[LLVMbugs] [Bug 6381] New: Variable length arrays are not permitted in C++

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Feb 22 03:28:59 PST 2010


http://www.llvm.org/bugs/show_bug.cgi?id=6381

           Summary: Variable length arrays are not permitted in C++
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P5
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: rene at exactcode.de
                CC: dgregor at apple.com
   Estimated Hours: 0.0


Starting to play with Clang++ I notices this (building our Open Source
ExactImage), currently on x86_64, T2 Linux:

lib/Colorspace.cc:442:22: error: variable length arrays are not permitted in
C++
 uint8_t gray_lookup[vmax];

the code is straight forward variable length array, like:

..
 const int vmax = 1 << bps;
 uint8_t gray_lookup[vmax];

The error already indicates it is intentionally disabled in clang++ for C++

Even old (3.x?) versions of G++ happily accept this.

Is there an std=c99 like option to allow this in Clang++? Maybe it should
accept it by default and warn that it is not portable, GNU extension (but I
think present in C++0x)?

-- 
Configure bugmail: http://www.llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the llvm-bugs mailing list