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

Bataev, Alexey a.bataev at hotmail.com
Sun Jul 13 23:09:52 PDT 2014


Richard,
Then the only possible solution is to create some temp var for array 
size and capture it (or make it global) + rebuild the original type to 
make it use this temp var. Another solution is to learn the capturing 
machinery to capture expressions.

Best regards,
Alexey Bataev
=============
Software Engineer
Intel Compiler Team

14.07.2014 4:17, Richard Smith пишет:
> 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