[PATCH] Allow lookup into dependent bases in static methods under -fms-compatibility

Reid Kleckner rnk at google.com
Tue Jun 10 16:12:28 PDT 2014


================
Comment at: lib/Sema/SemaExpr.cpp:1940
@@ +1939,3 @@
+                               const TemplateArgumentListInfo *TemplateArgs) {
+  CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(DC);
+
----------------
David Majnemer wrote:
> auto?
done

================
Comment at: lib/Sema/SemaExpr.cpp:1949
@@ +1948,3 @@
+  SourceLocation Loc = NameInfo.getLoc();
+  unsigned DI = diag::warn_found_via_dependent_bases_lookup;
+  DiagnosticBuilder DB = S.Diag(Loc, DI) << NameInfo.getName();
----------------
Richard Smith wrote:
> This diagnostic seems inappropriate: it says the member was "found by lookup into dependent bases", but we don't know that. All we know is it wasn't found by normal lookup. Maybe rephrase it to only suggest that the name was not found by normal lookup?
What do you think of this diagnostic text?
  warning: use of undeclared identifier 'StartWindowProc'; lookup into dependent bases of class template 'Derived' is a Microsoft extension
I'm trying to make it phrase well for -pedantic-errors.

================
Comment at: lib/Sema/SemaExpr.cpp:1952
@@ +1951,3 @@
+
+  if (MD->isInstance()) {
+    DB << FixItHint::CreateInsertion(Loc, "this->");
----------------
Richard Smith wrote:
> This isn't exactly correct. You should also check `S.CXXThisTypeOverride`; if that's set, then member accesses with `this->` are OK even though we're not in a member function. (This happens when parsing a trailing return type or default initializer.)
I wasn't trying to be this general, but I went ahead and implemented it with some extra tests.

http://reviews.llvm.org/D4079






More information about the cfe-commits mailing list