================
@@ -16304,11 +16308,13 @@ 
TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *E) {
   // (A ClassTemplateSpecializationDecl is always a dependent context.)
   while (DC->isRequiresExprBody() || isa<CXXExpansionStmtDecl>(DC))
     DC = DC->getParent();
-  if ((getSema().isUnevaluatedContext() ||
-       getSema().isConstantEvaluatedContext()) &&
-      !(dyn_cast_or_null<CXXRecordDecl>(DC->getParent()) &&
-        cast<CXXRecordDecl>(DC->getParent())->isGenericLambda()) &&
-      (DC->isFileContext() || !DC->getParent()->isDependentContext()))
+  if (getDerived().IsLambdaAlwaysDependent())
+    DependencyKind = CXXRecordDecl::LDK_AlwaysDependent;
----------------
zyn0217 wrote:

So I suggest you as a human really think about this issue, not simply ask your 
agents design/generate and pretend it's working.

To demonstrate what I meant, here is an example which is rejected by clang 16:

```cpp
template <class>
concept C = false;

template <int> struct bad {
  template <auto = []<C... U>(U...) { return 42; }(1, 2)>
  struct X {};
};

bad<1>::X x;
```

and with this PR, yes it stops crashing, but it also caused to accept invalid 
code.

https://github.com/llvm/llvm-project/pull/222541
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to