[cfe-dev] Strange return value of Sema::CheckFunctionReturnType

Reid Kleckner via cfe-dev cfe-dev at lists.llvm.org
Tue May 2 13:16:57 PDT 2017


If this check can never fail and is cheap, we should just strengthen it to
an assertion to check that GetFullTypeForDeclarator diagnoses this for us.

On Tue, May 2, 2017 at 10:03 AM, Keane, Erich via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> I dug through this a bit.  It is pretty clearly a bug, however I was
> unable to get this line to actually be hit.  It seems that
> GetFullTypeForDeclarator gets called before this, and fails it first.  I'm,
> not sure HOW we could possibly reproduce this, since there doesn't seem to
> be a code path that would hit this before GetFullTypeForDeclarator.
>
> Perhaps it would be valid to fix it for 'correctness' sake, and forgive
> its lack of test?
>
> Message: 6
> Date: Tue, 2 May 2017 17:27:54 +0100
> From: mats petersson via cfe-dev <cfe-dev at lists.llvm.org>
> To: 陳韋任 <chenwj.cs97g at g2.nctu.edu.tw>
> Cc: Clang Dev <cfe-dev at lists.llvm.org>
> Subject: Re: [cfe-dev] Strange return value of
>         Sema::CheckFunctionReturnType
> Message-ID:
>         <CAL-htr72Ry1Mg3t=qLeTMeK3wg9XHMoFN+NTSvEwc+Nu-_psUg at mail.
> gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> On 2 May 2017 at 16:08, 陳韋任 <chenwj.cs97g at g2.nctu.edu.tw> wrote:
>
> > 2017-05-02 22:41 GMT+08:00 mats petersson <mats at planetcatfish.com>:
> > > Looks like a bug to me. It should return `true`. I was going to say
> that
> > > it's a minor bug, (where `0` and `false` are possible to convert in
> > either
> > > direction, but it's actually returning an incorrect result.
> > >
> > > A patch to fix this, and adding a test-case would probably be
> > appreciated.
> >
> > Would be happy to. But I never use Objective-C, writing a test case would
> > be
> > hard to me...
> >
>
> Neither have I, but I'm pretty sure that it can't be TERRIBLY hard...
>
> --
> Mats
>
> >
> > --
> > Wei-Ren Chen (陳韋任)
> > Homepage: https://people.cs.nctu.edu.tw/~chenwj
> >
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170502/e12e2265/attachment.html>


More information about the cfe-dev mailing list