/// inline namespaces.
bool isTransparentContext() const;
- bool Encloses(DeclContext *DC) const {
- for (; DC; DC = DC->getParent())
- if (DC == this)
- return true;
- return false;
- }
+ /// \brief Determine whether this declaration context encloses the
+ /// declaration context DC.
+ bool Encloses(DeclContext *DC);
/// getPrimaryContext - There may be many different
/// declarations of the same entity (including forward declarations
return false;
}
+bool DeclContext::Encloses(DeclContext *DC) {
+ if (getPrimaryContext() != this)
+ return getPrimaryContext()->Encloses(DC);
+
+ for (; DC; DC = DC->getParent())
+ if (DC->getPrimaryContext() == this)
+ return true;
+ return false;
+}
+
DeclContext *DeclContext::getPrimaryContext() {
switch (DeclKind) {
case Decl::TranslationUnit:
X0<T, U>::operator T*() const {
return &value;
}
+
+namespace N { template <class X> class A {void a();}; }
+namespace N { template <class X> void A<X>::a() {} }