[PATCH] Allow lookup into dependent bases in static methods under -fms-compatibility
Richard Smith
richard at metafoo.co.uk
Mon Jun 9 18:18:05 PDT 2014
================
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();
----------------
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?
================
Comment at: lib/Sema/SemaExpr.cpp:1952
@@ +1951,3 @@
+
+ if (MD->isInstance()) {
+ DB << FixItHint::CreateInsertion(Loc, "this->");
----------------
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.)
http://reviews.llvm.org/D4079
More information about the cfe-commits
mailing list