================ @@ -5287,6 +5287,36 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, // Check for auto functions and trailing return type and adjust the // return type accordingly. if (!D.isInvalidType()) { + // [dcl.fct]p6: + // + // An explicit-object-parameter-declaration is a parameter-declaration + // with a this specifier. An explicit-object-parameter-declaration shall + // appear only as the first parameter-declaration of a + // parameter-declaration-list of either: + // + // - a member-declarator that declares a member function [class.mem], or + // - a lambda-declarator [expr.prim.lambda]. + DeclaratorContext C = D.getContext(); + ParmVarDecl *First = + FTI.NumParams + ? dyn_cast_if_present<ParmVarDecl>(FTI.Params[0].Param) + : nullptr; + if (First && First->isExplicitObjectParameter() && + C != DeclaratorContext::LambdaExpr && + + // Either not a member or nested declarator in a member. + (C != DeclaratorContext::Member || + D.getInnermostNonParenChunk() != &DeclType) && + + // Allow out-of-line definitions if we have a scope spec. + D.getCXXScopeSpec().isEmpty()) { ---------------- cor3ntin wrote:
What about ```cpp namespace a { void f(); }; void a::f(this auto) {}``` https://github.com/llvm/llvm-project/pull/89078 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits