[cfe-commits] r93513 - in /cfe/trunk: lib/Sema/SemaCXXScopeSpec.cpp test/SemaTemplate/member-template-access-expr.cpp

Douglas Gregor dgregor at apple.com
Fri Jan 15 08:05:35 PST 2010


Author: dgregor
Date: Fri Jan 15 10:05:33 2010
New Revision: 93513

URL: http://llvm.org/viewvc/llvm-project?rev=93513&view=rev
Log:
When determining whether the type is the current instantiation, strip
qualifiers. Fixes PR6021.


Modified:
    cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp
    cfe/trunk/test/SemaTemplate/member-template-access-expr.cpp

Modified: cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp?rev=93513&r1=93512&r2=93513&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp Fri Jan 15 10:05:33 2010
@@ -30,9 +30,9 @@
   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())

Modified: cfe/trunk/test/SemaTemplate/member-template-access-expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/member-template-access-expr.cpp?rev=93513&r1=93512&r2=93513&view=diff

==============================================================================
--- cfe/trunk/test/SemaTemplate/member-template-access-expr.cpp (original)
+++ cfe/trunk/test/SemaTemplate/member-template-access-expr.cpp Fri Jan 15 10:05:33 2010
@@ -103,3 +103,23 @@
     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>();
+      }
+    };
+  };
+}





More information about the cfe-commits mailing list