[PATCH] D28510: Reinstate CWG1607 restrictions on lambdas appearing inside certain constant-expressions
Faisal Vali via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 9 20:13:00 PST 2017
faisalv created this revision.
faisalv added a reviewer: rsmith.
faisalv added a subscriber: cfe-commits.
faisalv set the repository for this revision to rL LLVM.
faisalv added a project: clang-c.
This patch disables lambda expressions (especially Immediately Invoked Lambda Expressions (IILEs, to borrow a term from the all-mighty ecmascript ;)) from appearing within potentially mangled contexts.
The approach is a rather primitive/inelegant one. Instead of enumerating all the various syntactic constant-expression contexts at a finer level of granularity and then passing that information through to each call of ParseConstantExpression, we simply set a flag that forbids lambda expressions (when we know we are in the forbidden context). There is probably an opportunity here to streamline the machinery that prohibits lambdas in certain contexts across the various versions of C++ further - but that could be re-engineered if/when Louis Dionne's paper on Lambdas in Unevaluated contexts gets incorporated into the working draft.
Would appreciate some feedback here - thanks!
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 12076 bytes
Desc: not available
More information about the cfe-commits