diff options
Diffstat (limited to 'clang/lib/Sema/SemaExprMember.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExprMember.cpp | 48 |
1 files changed, 1 insertions, 47 deletions
diff --git a/clang/lib/Sema/SemaExprMember.cpp b/clang/lib/Sema/SemaExprMember.cpp index 1c34ace8562..fc776e31a47 100644 --- a/clang/lib/Sema/SemaExprMember.cpp +++ b/clang/lib/Sema/SemaExprMember.cpp @@ -1001,53 +1001,7 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType, BaseExpr = Converted.get(); } - LambdaScopeInfo *const CurLSI = getCurLambda(); - // If this is an implicit member reference and the overloaded - // name refers to both static and non-static member functions - // (i.e. BaseExpr is null) and if we are currently processing a lambda, - // check if we should/can capture 'this'... - // Keep this example in mind: - // struct X { - // void f(int) { } - // static void f(double) { } - // - // int g() { - // auto L = [=](auto a) { - // return [](int i) { - // return [=](auto b) { - // f(b); - // //f(decltype(a){}); - // }; - // }; - // }; - // auto M = L(0.0); - // auto N = M(3); - // N(5.32); // OK, must not error. - // return 0; - // } - // }; - // - if (!BaseExpr && CurLSI) { - SourceLocation Loc = R.getNameLoc(); - if (SS.getRange().isValid()) - Loc = SS.getRange().getBegin(); - DeclContext *EnclosingFunctionCtx = CurContext->getParent()->getParent(); - // If the enclosing function is not dependent, then this lambda is - // capture ready, so if we can capture this, do so. - if (!EnclosingFunctionCtx->isDependentContext()) { - // If the current lambda and all enclosing lambdas can capture 'this' - - // then go ahead and capture 'this' (since our unresolved overload set - // contains both static and non-static member functions). - if (!CheckCXXThisCapture(Loc, /*Explcit*/false, /*Diagnose*/false)) - CheckCXXThisCapture(Loc); - } else if (CurContext->isDependentContext()) { - // ... since this is an implicit member reference, that might potentially - // involve a 'this' capture, mark 'this' for potential capture in - // enclosing lambdas. - if (CurLSI->ImpCaptureStyle != CurLSI->ImpCap_None) - CurLSI->addPotentialThisCapture(Loc); - } - } + const DeclarationNameInfo &MemberNameInfo = R.getLookupNameInfo(); DeclarationName MemberName = MemberNameInfo.getName(); SourceLocation MemberLoc = MemberNameInfo.getLoc(); |