[PATCH] D6700: Diagnose UnresolvedLookupExprs that resolve to instance members in static methods

John McCall via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 13 14:33:32 PDT 2015


rjmccall added inline comments.

================
Comment at: lib/Sema/TreeTransform.h:9135
@@ +9134,3 @@
+    if (NamedDecl *D = R.getAsSingle<NamedDecl>()) {
+      D = D->getUnderlyingDecl();
+      if (isa<FieldDecl>(D) || isa<IndirectFieldDecl>(D) ||
----------------
getAsSingle already looks through to the underlying decl.

================
Comment at: lib/Sema/TreeTransform.h:9138
@@ +9137,3 @@
+          isa<MSPropertyDecl>(D))
+        return getSema().BuildPossibleImplicitMemberExpr(
+            SS, SourceLocation(), R, /*TemplateArgs=*/nullptr,
----------------
rnk wrote:
> I believe this will always fail, so one alternative way to do this would be to add a stripped down entry point into Sema just for template instantiation that diagnoses UnresolvedLookupExprs finding instance members.
At the very least, we should leave a comment explaining that we don't expect this to succeed, and that we're just doing this for diagnostic purposes.  Might want to assert that as well.


http://reviews.llvm.org/D6700





More information about the cfe-commits mailing list