<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: arial,helvetica,sans-serif; font-size: 10pt; color: #000000'><br><hr id="zwchr"><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px; color: rgb(0, 0, 0); font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><b>From: </b>"James Dennett via cfe-dev" <cfe-dev@lists.llvm.org><br><b>To: </b>"Akira Hatanaka" <ahatanak@gmail.com><br><b>Cc: </b>"Richard Smith" <richard@metafoo.co.uk>, "Clang Dev" <cfe-dev@lists.llvm.org><br><b>Sent: </b>Wednesday, May 25, 2016 6:37:46 PM<br><b>Subject: </b>Re: [cfe-dev] c++ question: can lambda be used in VLA?<br><br><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: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); 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: 1px solid 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: 1px solid 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 id="DWT22524">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></div></div></blockquote>What did the most recent wording for C++ ARBs say about this issue?<br><br> -Hal<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px; color: rgb(0, 0, 0); font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div></div><div><br></div><div>-- James</div></div></div></div>
<br>_______________________________________________<br>cfe-dev mailing list<br>cfe-dev@lists.llvm.org<br>http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev<br></blockquote><br><br><br>-- <br><div><span name="x"></span>Hal Finkel<br>Assistant Computational Scientist<br>Leadership Computing Facility<br>Argonne National Laboratory<span name="x"></span><br></div></div></body></html>