[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
Tue Jan 10 04:01:43 PST 2017


faisalv added inline comments.


================
Comment at: include/clang/Sema/Sema.h:894-895
 
+    /// \brief Whether lambda expressions are forbidden here.
+    bool IsLambdaExprForbidden;
+
----------------
rsmith wrote:
> Rather than adding a flag, how about we have two different kinds of `ExpressionEvaluationContext` for constant expressions: a generic "constant expression" context and a "constant expression in signature" context?
But not all lambdas that appear in template arguments are in signatures - so should we split it into ConstantEvaluated, ConstantEvaluatedInSignatureOrTemplateArg ? 


================
Comment at: lib/Parse/ParseDecl.cpp:6254
+      NumElements = ParseConstantExpression(NotTypeCast,
+       /*IsLambdaExprForbidden=*/D.getContext() == D.PrototypeContext);
     } else {
----------------
I suppose we should forbid these in a lambda parameter declaration clause too?


Repository:
  rL LLVM

https://reviews.llvm.org/D28510





More information about the cfe-commits mailing list