On Thu, May 9, 2013 at 11:41 AM, Jason Merrill <ja...@redhat.com> wrote:
> At the last C++ standards meeting, we agreed to add VLAs to the language.
> But they're significantly different from GNU/C99 VLAs: you can't form a
> pointer to a VLA, or take its sizeof, or really anything other than directly
> use it.  We also need to throw an exception if we try to create one with a
> negative or too large bound.  And we need to support lambda capture and
> range-based for loops.
>
> The one thing I'm nervous about is our handling of an array which turns out
> at runtime to be of length 0.  GCC has always allowed zero-length arrays,
> and they work fine, so I don't want to break existing code, but I also want
> to offer a fully-conforming mode.  What I ended up deciding to do is throw
> on zero with -std=c++1y and not with -std=gnu++1y.  But I'm not terribly
> comfortable with this answer; anyone have any better ideas?

I am fine with this distinction.  I suspect that we don't have
too many codes with VLA array with zero length in existing C++ mode.


>
> The first patch accepts VLAs in C++1y mode and adds new functionality; the
> second patch adds diagnostics for invalid uses of C++1y VLAs.
>
> Tested x86_64-pc-linux-gnu, applying to trunk.

Reply via email to