================
@@ -6860,12 +6966,19 @@ void SemaCodeCompletion::CodeCompleteQualifiedId(Scope 
*S, CXXScopeSpec &SS,
   // resolves to a dependent record.
   DeclContext *Ctx = SemaRef.computeDeclContext(SS, /*EnteringContext=*/true);
 
+  std::optional<Sema::ContextRAII> SavedContext;
+  // When completing a definition, simulate that we are in class scope to 
access
+  // private methods.
+  if (IsInDeclarationContext && Ctx != nullptr)
+    SavedContext.emplace(SemaRef, Ctx);
+
   // Try to instantiate any non-dependent declaration contexts before
   // we look in them. Bail out if we fail.
   NestedNameSpecifier NNS = SS.getScopeRep();
   if (NNS && !NNS.isDependent()) {
-    if (Ctx == nullptr || SemaRef.RequireCompleteDeclContext(SS, Ctx))
+    if (Ctx == nullptr || SemaRef.RequireCompleteDeclContext(SS, Ctx)) {
----------------
HighCommander4 wrote:

nit: drop this brace addition

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

Reply via email to