[PATCH] D119094: [clang] Don't emit redundant warnings for 'return;'

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 7 09:26:32 PST 2022


sammccall added a comment.

In D119094#3301481 <https://reviews.llvm.org/D119094#3301481>, @Quuxplusone wrote:

> In D119094#3301403 <https://reviews.llvm.org/D119094#3301403>, @sammccall wrote:
>
>> In D119094#3301297 <https://reviews.llvm.org/D119094#3301297>, @Quuxplusone wrote:
>>
>>> Unfortunately some existing tests fail: https://reviews.llvm.org/harbormaster/unit/view/2282838/
>>> I haven't yet figured out why consteval functions are considered to have `FD->isInvalidDecl()`. There's also an Objective-C failure that I assume indicates sometimes (when this is a //method// not a //function//) we have no `FD` at all. I'd need to solve both of these problems (the former being the difficult one) before I can make progress here.
>>
>> The example seems to be invalid even apart from the missing return value. (I assume on purpose).
>
> Ohhh, wow, I had missed that. In that case, I'm shocked that Clang isn't giving any more serious error message: shouldn't it be considered invalid, and diagnosed as an error, to have a `constexpr` definition followed by a `consteval` redefinition?
> https://godbolt.org/z/vKjGvEor8
> However, I think the pattern of operators used (`++--*/*/`) indicates that the original author made a typo there, and it should always have been `+-+-*/*/`. So I'll feel good about changing that test.

It is diagnosed as an error (err_constexpr_redecl_mismatch), but in this case the error for the missing return value ends up suppressing it somehow.

I'm not sure exactly what the intent of this test was :-(


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119094/new/

https://reviews.llvm.org/D119094



More information about the cfe-commits mailing list