diff options
-rw-r--r-- | lib/Sema/SemaCXXScopeSpec.cpp | 4 | ||||
-rw-r--r-- | test/SemaTemplate/member-template-access-expr.cpp | 20 |
2 files changed, 22 insertions, 2 deletions
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<T*>(); } }; + +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<X>(); + } + }; + }; +} |