r187769 - Fix for PR16570: when comparing two function pointers, discard qualifiers when

Richard Trieu rtrieu at google.com
Fri Aug 9 14:51:51 PDT 2013


Thanks Eli.  Committed at r188112.


On Fri, Aug 9, 2013 at 10:17 AM, Eli Friedman <eli.friedman at gmail.com>wrote:

> On Mon, Aug 5, 2013 at 8:44 PM, Richard Trieu <rtrieu at google.com> wrote:
> > Author: rtrieu
> > Date: Mon Aug  5 22:44:10 2013
> > New Revision: 187769
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=187769&view=rev
> > Log:
> > Fix for PR16570: when comparing two function pointers, discard
> qualifiers when
> > comparing non-reference function parameters.  The qualifiers don't
> matter for
> > comparisons.
> >
> > Added:
> >     cfe/trunk/test/SemaCXX/function-pointer-arguments.cpp
> > Modified:
> >     cfe/trunk/lib/Sema/SemaOverload.cpp
> >
> > Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=187769&r1=187768&r2=187769&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
> > +++ cfe/trunk/lib/Sema/SemaOverload.cpp Mon Aug  5 22:44:10 2013
> > @@ -2584,9 +2584,17 @@ bool Sema::FunctionArgTypesAreEqual(cons
> >    for (FunctionProtoType::arg_type_iterator O =
> OldType->arg_type_begin(),
> >         N = NewType->arg_type_begin(),
> >         E = OldType->arg_type_end(); O && (O != E); ++O, ++N) {
> > -    if (!Context.hasSameType(*O, *N)) {
> > -      if (ArgPos) *ArgPos = O - OldType->arg_type_begin();
> > -      return false;
> > +    if (!(*O)->isReferenceType() && !(*N)->isReferenceType()) {
> > +      if (!Context.hasSameType(O->getUnqualifiedType(),
> > +                               N->getUnqualifiedType())) {
> > +        if (ArgPos) *ArgPos = O - OldType->arg_type_begin();
> > +        return false;
> > +      }
> > +    } else {
> > +      if (!Context.hasSameType(*O, *N)) {
> > +        if (ArgPos) *ArgPos = O - OldType->arg_type_begin();
> > +        return false;
> > +      }
>
> These two branches do the same thing because reference types are never
> qualified.
>
> -Eli
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130809/e6c86ba6/attachment.html>


More information about the cfe-commits mailing list