[PATCH] [C++11] Support for capturing of variable length arrays in lambda expression.

Richard Smith richard at metafoo.co.uk
Sun Jul 13 17:17:59 PDT 2014


The [C++ Array Extensions draft TS](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3639.html) specifies how the C++ committee thinks VLAs in C++ ("Arrays of Runtime Bound") should work, and I think it has different semantics for lambda captures from those provided here =( In particular, it only allows the array bound expression to be evaluated a single time, so the array bound itself must be captured, rather than the variables that it references.

So, we have a choice: we can go with what you have here (which seems reasonable if we're providing the C-style VLAs), and we should do something different if instead we want to align ourselves with the Array Extensions draft TS and ARB semantics. If Array Extensions is going to become a full TS, then we'll want to align with it eventually, and it doesn't make sense to me to differ from it now, but it's not completely clear if that's going to happen (there seemed to be weak consensus at the previous committee meeting to abandon it).

Thoughts?

http://reviews.llvm.org/D4368






More information about the cfe-commits mailing list