diff options
author | Anders Carlsson <andersca@mac.com> | 2009-09-11 05:54:14 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-09-11 05:54:14 +0000 |
commit | ed90c4ee8cfed90be92741313e1715d308ed2fe3 (patch) | |
tree | 842ac7201b6be846528d68bb6eefbdfcccbdd4e5 /lib/Sema | |
parent | c4e7019d5c9034a2d84ee4695f8e98dc025ac131 (diff) |
Fix PR4878 for real.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81507 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index a4a612306a..4df55e6762 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -1002,7 +1002,16 @@ Sema::BuildDeclarationNameExpr(SourceLocation Loc, NamedDecl *D, MarkDeclarationReferenced(Loc, D); if (PerformObjectMemberConversion(This, D)) return ExprError(); - if (DiagnoseUseOfDecl(D, Loc)) + + bool ShouldCheckUse = true; + if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(D)) { + // Don't diagnose the use of a virtual member function unless it's + // explicitly qualified. + if (MD->isVirtual() && (!SS || !SS->isSet())) + ShouldCheckUse = false; + } + + if (ShouldCheckUse && DiagnoseUseOfDecl(D, Loc)) return ExprError(); return Owned(BuildMemberExpr(Context, This, true, SS, D, Loc, MemberType)); |