[cfe-dev] Variable length arrays are not permitted in C++
eli.friedman at gmail.com
Tue Feb 16 09:08:42 PST 2010
On Tue, Feb 16, 2010 at 7:52 AM, Rene Rebe <rene at exactcode.de> wrote:
> On 16.02.2010, at 16:39, Eli Friedman wrote:
>> On Tue, Feb 16, 2010 at 3:21 AM, Rene Rebe <rene at exactcode.de> wrote:
>>> Hi all,
>>> 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];
>> VLAs are disabled until someone goes through and makes sure they work
>> properly and that we give appropriate errors for C++-only constructs.
> Well, what's needed? I'm certainly interested in LLVM and getting further into it. Though I'm not yet too familiar with the codebase, yet, nor am an language lawyer.
> Basic, POD, use appear to just work after I enabled it with the patch posted before. Any pointers welcome.
Anything that works in C probably works in C++ as well; it gets
complicated when we try to deal with constructs like VLAs with
non-trivial destructors, using a VLA with new, attempting to use a
variably modified type as a template argument, attempting to use a
variably modified type inside a local class, etc. The idea is that if
we're going to support VLAs inside of C++, we should make sure they
work correctly in every situation, not just in trivial cases.
More information about the cfe-dev