From: Douglas Gregor Date: Fri, 15 Jan 2010 16:05:33 +0000 (+0000) Subject: When determining whether the type is the current instantiation, strip X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1cfb7da1f34723021f362cb09636965e5ade0c6d;p=clang When determining whether the type is the current instantiation, strip qualifiers. Fixes PR6021. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93513 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaCXXScopeSpec.cpp b/lib/Sema/SemaCXXScopeSpec.cpp index 8594583ec3..6006bca4b0 100644 --- a/lib/Sema/SemaCXXScopeSpec.cpp +++ b/lib/Sema/SemaCXXScopeSpec.cpp @@ -30,9 +30,9 @@ getCurrentInstantiationOf(ASTContext &Context, DeclContext *CurContext, if (T.isNull()) return 0; - T = Context.getCanonicalType(T); + T = Context.getCanonicalType(T).getUnqualifiedType(); - for (DeclContext *Ctx = CurContext; Ctx; Ctx = Ctx->getParent()) { + for (DeclContext *Ctx = CurContext; Ctx; Ctx = Ctx->getLookupParent()) { // If we've hit a namespace or the global scope, then the // nested-name-specifier can't refer to the current instantiation. if (Ctx->isFileContext()) diff --git a/test/SemaTemplate/member-template-access-expr.cpp b/test/SemaTemplate/member-template-access-expr.cpp index 9edefe8b63..ea17cdbb58 100644 --- a/test/SemaTemplate/member-template-access-expr.cpp +++ b/test/SemaTemplate/member-template-access-expr.cpp @@ -103,3 +103,23 @@ struct X5 { this->f(); } }; + +namespace PR6021 { + template< class T1, class T2 > + class Outer + { + public: // Range operations + template< class X > X tmpl( const X* = 0 ) const; + + struct Inner + { + const Outer& o; + + template< class X > + operator X() const + { + return o.tmpl(); + } + }; + }; +}