<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, May 25, 2016 at 4:19 PM, Akira Hatanaka <span dir="ltr"><<a href="mailto:ahatanak@gmail.com" target="_blank">ahatanak@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><span class=""><div class="gmail_quote">On Tue, May 24, 2016 at 7:11 PM, James Dennett <span dir="ltr"><<a href="mailto:james.dennett@gmail.com" target="_blank">james.dennett@gmail.com</a>></span> wrote:<br></div></span><div class="gmail_quote"><span class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>On Tue, May 24, 2016 at 6:25 PM, Akira Hatanaka via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">I wasn't requesting that clang accept lambda expressions used for array bounds but was asking whether it was valid in c++. Is this something that is open to interpretation because it's not covered by the standard?<div><br></div><div>FYI, this isn't something that I made up. It was in a code a user wrote.<div><div><br></div></div></div></div></blockquote><div><br></div></span><div>It's covered by the standard, and as Clang's error message says, lambdas are not allowed in constant expressions in C++11 or C++14.</div><div><br></div></div></div></div></blockquote><div><br></div></span><div>Yes, the c++ standard gives a list of subexpressions that are not allowed in constant expressions and lambda expression is one of them.</div><div><br></div><div>This doesn't seem to apply to C99's extension for variable length arrays because array sizes are not required to be constant expressions.</div><div><br></div></div></div></div></blockquote><div><br></div><div>I was replying to you saying that you were "asking whether it was valid in C++", and whether "it's not covered by the standard".</div><div><br></div><div>C99 doesn't have lambdas, so it doesn't allow this.  C++ doesn't have VLAs, so it doesn't allow it.</div><div><br></div><div>The de facto language accepted by Clang doesn't accept it, as you already noted.</div><div><br></div><div>There's no specification that tells us what the "right thing to do" is here.  We could extend Clang to support this non-standard combination of C99 with C++11, and it might even make it a little more consistent, but if it adds any implementation complexity then it may not be worthwhile to support a corner case that's not allowed by any language standard.</div><div><br></div><div>-- James</div></div></div></div>