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

mats petersson via cfe-dev cfe-dev at lists.llvm.org
Tue May 2 07:41:53 PDT 2017


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.

--
Mats

On 2 May 2017 at 15:26, 陳韋任 via cfe-dev <cfe-dev at lists.llvm.org> wrote:

> Hi All,
>
>   While reading Sema::CheckFunctionReturnType in SemaType.cpp [1], I
> find something strange.
> From the context, the return value of CheckFunctionReturnType indicate
> something is invalid.
> If the check fail, CheckFunctionReturnType returns true.
>
> The other two checks in CheckFunctionReturnType return true as I
> expected. But the following
> check return 0, which should be false.
>
>     if (T->isObjCObjectType()) {
>       Diag(Loc, diag::err_object_cannot_be_passed_returned_by_value) << 0
> << T;
>       return 0;
>     }
>
> Is it a bug? Or I am reading the code wrong?
>
> Thanks.
>
> [1] https://clang.llvm.org/doxygen/SemaType_8cpp_source.html
>
> Regards,
> chenwj
>
> --
> 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/44a5b4b9/attachment.html>


More information about the cfe-dev mailing list