[PATCH] Implement capturing for generic lambdas

Faisal Vali faisalv at yahoo.com
Wed Nov 6 18:47:59 PST 2013

Comment at: include/clang/Sema/ScopeInfo.h:725
@@ +724,3 @@
+  /// capture such variables. 
+  ///    
+  void markVariableExprAsNonODRUsed(Expr *CapturingVarExpr) {
This is a very illuminating comment:
"The problem is that the set of captures for a lambda is part of the ABI
(since lambda layout can be made visible through inline functions and the
like), and there are no guarantees as to which cases we'll manage to build
an lvalue-to-rvalue conversion in, when parsing a template -- some
seemingly harmless change elsewhere in Sema could cause us to start or stop
building such a node. So we need a rule that anyone can implement and get
exactly the same result."

I'd like to add this here - so as to discourage others from venturing on this potentially fool-hardy errand.


More information about the cfe-commits mailing list