diff --git a/clang/lib/Sema/SemaAccess.cpp b/clang/lib/Sema/SemaAccess.cpp index 47aea3759392..66e6e6446550 100644 --- a/clang/lib/Sema/SemaAccess.cpp +++ b/clang/lib/Sema/SemaAccess.cpp @@ -1420,16 +1420,15 @@ static AccessResult CheckEffectiveAccess(Sema &S, AccessTarget &Entity) { assert(Entity.getAccess() != AS_public && "called for public access!"); - if (S.getLangOpts().MSVCCompat && - IsMicrosoftUsingDeclarationAccessBug(S, Loc, Entity)) - return AR_accessible; - switch (IsAccessible(S, EC, Entity)) { case AR_dependent: DelayDependentAccess(S, EC, Loc, Entity); return AR_dependent; case AR_inaccessible: + if (S.getLangOpts().MSVCCompat && + IsMicrosoftUsingDeclarationAccessBug(S, Loc, Entity)) + return AR_accessible; if (!Entity.isQuiet()) DiagnoseBadAccess(S, Loc, EC, Entity); return AR_inaccessible; diff --git a/clang/test/SemaCXX/MicrosoftCompatibility.cpp b/clang/test/SemaCXX/MicrosoftCompatibility.cpp index 0971646e73b5..a3b96da448cb 100644 --- a/clang/test/SemaCXX/MicrosoftCompatibility.cpp +++ b/clang/test/SemaCXX/MicrosoftCompatibility.cpp @@ -111,6 +111,9 @@ public: class B : public A { private: using A::f; + void g() { + f(); // no diagnostic + } }; class C : public B {