[PATCH] D20500: [ms] Allow more unqualified lookup of types in dependent base classes

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Tue May 24 14:03:36 PDT 2016


rnk marked 4 inline comments as done.

================
Comment at: lib/Sema/SemaDecl.cpp:559-562
@@ -521,6 +558,6 @@
       }
     }
 
   return DeclSpec::TST_unspecified;
 }
 
----------------
rsmith wrote:
> Doesn't seem to be done? I can easily believe there's a good reason why we want two different paths for building a recovery nested name specifier, but I'd like to know what it is at least.
We should already be handling the case you are thinking of. We don't recover by using a dependent base in the NNS. We recover by using the class *deriving* from those bases in the NNS, like this:
  template <typename T, typename U>
  struct A : T, U {
    void *p() { return new /*A::*/ X; } // We hallucinate the commented out specifier
  };

`synthesizeCurrentNestedNameSpecifier` is doing something different. It's just looking for the nearest parent scope that can legitimately form an NNS, which means global scope, namespace scope, or record scope, mainly by skipping function scopes. This is sort of what it looks like:
  template <typename T = /*::*/ X> struct A { ... };
  namespace ns {
  template <typename T = /*ns::*/ X> struct B { ... };
  }




http://reviews.llvm.org/D20500





More information about the cfe-commits mailing list