================ @@ -13649,10 +13649,29 @@ TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *E) { // use evaluation contexts to distinguish the function parameter case. CXXRecordDecl::LambdaDependencyKind DependencyKind = CXXRecordDecl::LDK_Unknown; + DeclContext *DC = getSema().CurContext; + // A RequiresExprBodyDecl is not interesting for dependencies. + // For the following case, + // + // template <typename> + // concept C = requires { [] {}; }; + // + // template <class F> + // struct Widget; + // + // template <C F> + // struct Widget<F> {}; + // + // While we are here in substitution for Widget<F>, the parent of DC would be + // the template specialization itself. Thus, the lambda expression + // will be deemed as dependent even if we have non-dependent template + // arguments. + // (A ClassTemplateSpecializationDecl is always a dependent context.) + if (DC->getDeclKind() == Decl::Kind::RequiresExprBody) + DC = DC->getParent(); ---------------- cor3ntin wrote:
Do we get into the same issue if there are multiple nested `requires`? https://github.com/llvm/llvm-project/pull/83997 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits