Strange return value of Sema::CheckFunctionReturnType

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?




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...