[cfe-dev] No -Wdeprecated-declarations at all on virtual calls?

Stephan Bergmann sbergman at redhat.com
Tue Mar 11 01:10:00 PDT 2014


The code

>   bool ShouldCheckUse = true;
>   if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(MemberDecl)) {
>     // Don't diagnose the use of a virtual member function unless it's
>     // explicitly qualified.
>     if (MD->isVirtual() && !SS.isSet())
>       ShouldCheckUse = false;
>   }

in lib/Sema/SemaExprMember.cpp, originally introduced with r81460 to fix 
<http://llvm.org/bugs/show_bug.cgi?id=4878> "ability to call deprecated 
virtual methods in the same class without warning" prevents warnings on 
all virtual calls to such deprecated functions.  Not just when the call 
is from the same class, but also when a client of that class calls the 
function.

Is that intentional?  (I just had a case where it would have been useful 
to get the warning for the client-call case at least, and was surprised 
to not get a warning, esp. since GCC does give one.)

Stephan



More information about the cfe-dev mailing list