friend declaration; this used to be important but is now just a waste of time
plus an unreasonable assertion. Fixes PR6174.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101112
91177308-0d34-0410-b5e6-
96231b3b80d8
// class or function, the friend class or function is a member of
// the innermost enclosing namespace.
SearchDC = SearchDC->getEnclosingNamespaceContext();
-
- // Look up through our scopes until we find one with an entity which
- // matches our declaration context.
- while (S->getEntity() &&
- ((DeclContext *)S->getEntity())->getPrimaryContext() != SearchDC) {
- S = S->getParent();
- assert(S && "No enclosing scope matching the enclosing namespace.");
- }
}
// In C++, look for a shadow friend decl.
return a == b; // expected-note {{requested here}}
}
}
+
+
+// PR6174
+namespace test5 {
+ namespace ns {
+ class A;
+ }
+
+ class ns::A {
+ private: int x;
+ friend class B;
+ };
+
+ namespace ns {
+ class B {
+ int test(A *p) { return p->x; }
+ };
+ }
+}